I've had a couple people who were injured (knees) from "mashing" in spin class, where the instructor had them turn the resistance waaaaay up and pretend they were climbing a hill.
I asked if they switched gears while riding their real bikes, so they could keep cadence up hills. "Yup, we do." "Does your knee hurt when you're on your real bike?' "Nope, it doesn't." If you don't mash on your real bike, be very careful about how much you mash on the spin bike.
Like LateLate said, if it hurts it's not good. Listen to your knees, especially... cuz you don't want to end up in physical therapy! (insert evil laugh here)
"If Americans want to live the American Dream, they should go to Denmark." - Richard Wilkinson