I think that I would work out the ship direction vector first. So, if you take your ship object, store it's location, then move it back by 1 unit and store that location, you'd have a vector for the ships direction quite easily. Then, with just the ships location and your gravity source, work out a vector for the ship and the planet (or whatever) and normalize it.
That would give you 2 vectors, one that has to be adjusted to meet the other, the easiest way is probably to convert those vectors into angles for each axis. So you'd work out the X angle for the ships trajectory, and the gravity force, and adjust it to suit, then the same for the Z angle, the Y angle won't be an issue as long as the rotations are all local, it could just be left to roll left and right depending on the ships movement.
I got a fever, and the only prescription, is more memes.