The way to fight the Hydra is don't kill heads you don't have to. Because, for every head you kill, two more of that type appear. If the head(s) listed in the Victory Conditions (at the top of the screen) is not on the Battle Screen, don't attack any of the heads. Some of the heads may get themselves killed by talents like Repel Boarders but those you can't do anything about. Try to keep yourself and your Companions healed while waiting.
The Ebon Head will appear and disappear from the Battleboard. If it ever says the Ebon Head appears and you can't find it on the Battleboard on that turn, the Glitch is in effect and the only way out is to Flee and try again.
It helps to have a high-level friend, preferably a Privateer, along to help.