Just because something hurts does not necessarily mean it's good for you. I love exercising hard and "feeling the pain" but you should always be careful not to push so hard you injure yourself. Also, there are some popular fitness moves that might hurt but don't give you much benefit. For example - lying on your side and doing leg lifts could make your outer thigh feel tired, but there's not much muscle in the outer thigh so you're not effectively strengthening a muscle or increasing your metabolism. Another example I see often at spin class is to squat down on the pedals and hold. The isometric contraction doesn't burn many calories or increase strength but it makes the legs feel tired so instructors love to do it.
Next time you're hurting find out if the hurt is beneficial. If not, don't do it no matter what kind of looks you get at spin class.