Hold on to the UP arrow key or W to accelerate. You can escape the ghost once you gain enough speed. It shouldn't take long.