There's a General Order telling our heroes what to do if the entire crewdies of a disease. It's a drastic step: the ship is to be scuttled.
We aren't aware of any other scenarios calling for the ship to be scuttled. It sometimes happens as a tactical ploy against hostile boarding, though. The skipper has great latitude on how to deal with such boarding, and for example "Rascals" shows scuttling is not mandatory and there are other measures such as lockups to be taken. We could deduce that possession scenarios warrant the same range of responses, up to scuttling if possession is widespread enough.
The key difference here is that possession is likely to wreak havoc with the chain of command. In outright hostile boarding, it's simple to deal with a dead or incapacitated superior officer and the subsequent reassigning of scuttling authority to the next in line. It's more difficult to skip a skipper who may or may not be possessed.
Another big problem is that a possessed key officer will typically be aware of the anti-possession procedure! The answer cannot be giving room to independent initiative, because that's the very thing a possession is trying to usurp. But a draconian solidification of the grip the top officers have on the ship is likely to backfire, too. Perhaps all we're left with is a "time out" protocol wherein the lowliest Crewman Fourth Rate can shut down and lock up at least some aspects of the starship, to be released only on the external authority of Starfleet Command? This still leaves an onboard Klingon spy capable of shutting down a ship's weapons just as she's trying to make an attack run on Ty'Gokor, but what other option is there?
Timo Saloniemi