A Ghost Ambush is a random occurrence that may happen once the player beats FireCage or SkySand. In an area where ghosts don't normally appear, the screen might become purple, the ghost theme will play, and 1 to 3 ghosts (depending on difficulty) will appear and chase the player. They disappear when you leave the screen.
The formula for a Ghost Ambush is quite complex, but the higher the difficulty, and the more gold orbs you have, the more likely you are to be ambushed. On top of this, Ghost Ambushes only occur in certain places. Specifically, rooms with an object called "obj_makeghosts" is present in most areas. Areas without this object include SkyTown, LongBeach, Bonus and RainbowDive.