Sleep now, wake up earlier and hit the gym in the morning. Or workout at home. Instead of the gym membership get yourself a bunch of dumbbells and an adjustable bench and go to town. Or ketlebells or whatever you're into.
I would opt for sleep. A workout that late could keep you up even later due to the endorphin and adrenaline rush. I would agree with the suggestion to sleep earlier and get a workout in the next morning.
Screw the gym. Sprint in place, do mountain climbers and other bodyweight card exercises for legs. Others have mentioned jump ropes, and you can activate all of your leg muscles with various movements with those. You can do crazy tabatas with kettlebells. All of this equipment is far cheaper than a gym membership in the long run. Get thermals for praise running. This is all coming from a lifelong gym rat. Screw the gym. From didn't need it neither do we :) Oh and get your sleep! This is just as important as the exercise itself.