Gunstar Heroes by the way uses double jump for gravity switch. If you jump during the biggest distance to the floor, you will switch to ceiling and vice versa.

By allowing some hysteresis concerning the jump height, this should be very well playable.