You wait. A pet at zero health is not glitched — it needs rest.
The experience that produced this answer is fairly typical: a vulture was tamed, then refused to attack, and clicking it showed the health bar empty. Asking around in the game's default chat turned up the explanation that the pet has to be left alone for a while to recover.
So if your pet is behaving oddly after a fight, give it time rather than trying to force it back into action.