desert a sinking ship
Abandon a failing enterprise before it is too late. For example, After seeing the company's financial statement, he knew it was time to desert a sinking ship. This metaphoric expression alludes to rats, which leave a vessel when it founders in a storm or runs aground so as to escape drowning. It was transferred to human behavior by about 1600.