How to paint a ghost with oils?
Painting the background first and then adding the ghost indeed sounds like the right procedure. That way you'll ensure the transparency of the ghost is realistic.
Like you mention, be sure to let the background dry long enough first before proceeding with painting the ghost.
To thin down the paint, I'd recommend simply using a little additional oil and even less solvent, or glazing the paint.
Even though increasing the amount of oil will increase the drying period - and you need to store the painting horizontally in a dust-free environment during this time - the risk of ruining the background is minimized. You can add quick-drying medium to speed up the drying process.
Using excessive amounts of oil in relation to pigment and solvent might cause the dried paint to be glossy, so to prevent this you need at least a little thinner in the mix.
It's hard to give straightforward advice on the amounts, though, since there are a lot of variables weighing in here. You can always experiment with processes like these by replicating them using similar materials.
If you use a thinner, paints already applied (in the background) might dissolve, depending on the drying time and pigments used, and mix with the current layer (the ghost), potentially causing both layers to lose their integrity.
As for the type of thinner, it doesn't matter that much when mixed with larger amounts of oil, I think. I've used turpentine and white spirit, and am currently trying out lavender (or spike) oil, which acts as a solvent, but is environment-friendly and non-toxic. It dries somewhat glossier than the other solvents when using it for glazing, in my experience, however. For that matter, if you have a well-ventilated workroom, I suggest white spirit, as it is the most matte-drying, and I think it dries the quickest as well.
Of course, if you plan on ultimately varnishing the painting using a glossy varnish, all these comments on the specularity of the paint mixtures don't really matter.

I also read that thinned paints should not be used as last layer since they tend to crack. So, how can I avoid this?

That's very strange advice, and the context seems quite important to me (e.g. what defines &quot;thinned&quot;?). Can you find that passage again?
As far as I know like almost all other painters, I usually thin all of my paints. The application of oil paints is based on this premise; since oil paints generally are no longer mixed manually by artisans, the manufacture of tubed versions necessitates they be highly concentrated, to facilitate their use (we can't practically increase the concentration, but we can thin it down).
The fat-over-lean rule applies here, meaning the closer you get to the surface layer, the fattier the paint applied should be to prevent it from drying before the underlying layers have dried. This can mean that the oil paints are used increasingly pure from the tube (as opposed to being mixed with thinner, which will make them leaner), but the artist can also decide to add additional oil.