Good question. I have never tried to apply gravity when the player is colliding with a large complex object.
I only know on simple objects you can get the “normal” direction from a collision which still might work in this case.
Try using a collide event and getting the normal from it so you can apply your gravity inversely.