"How many people are there in our class in total?"
Yes, 课 refers not to the students but to the lesson itself, usually, so it makes sense that 下课 means recess. The syllabus itself is 课程; learning is 学习.
班 here means class. Here are some examples: to go back to class e.g. after recess for the next class (lesson) it is 回班上课, attending/teaching a class (lesson) is 上了/教了一堂课.
It is better to see 上班 and 上课 as two separate things, it is a little confusing when mixed together. 课 is generally for class, learning, lesson; 班 for class, so that the usage of 班 in 上班 is something of an exception.