Just read this thread and registered purely to comment.
As this is a spin class and it's happening when you're standing on the pedals, this gives us a clue. Usually that doesn't ever happen when we are out riding in the wild, but it probably could if we were in a low enough gear, but usually when we stand on the pedals we are going to push hard to speed up, or climb so the extra resistance on the pedals supports our weight. So.....i'm curious, when you're spinning seated, are you using a relatively easy resistance, then when you stand, that same resistance isn't enough for you to support your weight standing through the pedal revolution? If not.....the solution might just be to increase your resistance...even if it means a tougher workout through the whole class.