Have you tried writing in a torque based stabiliztion routine?

Something so that if your pan tilt roll changes drastically, then you anti-torque the vehicle to keep from flipping. By programming a naively adaptive routing (torque right if spinning left; torque left if sprinning right), you should in theory prevent wild "flippings"

Or how about an adaptive setmaxspeed routine? If you start flipping beyond limits, you set phent_setmaxspeed(my,1000,0) and this will stop your rotation (ie flipping) dead in it's tracks. You can then script in or let the PE return the car to it's natural position.

Yet another solution is to pause the PE if you start flipping beyond the limit (say my.tilt or my.roll >90)....Hence, you disable the PE, readjust your vehicle and re-engage when the vehicle is where you want it. It should all be done in a frame or two, thus making this solution the best bet in my mind.