As the DM of a campaign, I have an army that is about to overrun the town my players have been living in. I want to create an encounter in which the players meet a small part of the army lead by an evil NPC. In this encounter, I would like the PCs to think that they are doing well only to find out that they are in big trouble. In order to accomplish this, I want the evil NPC leader to come back to life after they kill him. It needs to be an instantaneous thing he does himself so that he can get back up in the middle of the fight. How can I accomplish this?
I'd like to stay close to the rules because I have a bad rules lawyer in our group, and because I want the subsequent loot from this encounter to be explainable. Also, I'd like the NPC to have a clear set of limitations in the event that the party manages to beat him or do something else unexpected. If I just make up stuff, then the players might feel cheated.
Note: The party is 6 level 5 characters with very good gear. The NPC is an officer of the invading army. While the army consists mostly of undead, it also contains red mages of Thay (Forgotten Realms setting), and warriors. The evil NPC is most likely a human cleric level 7 or higher with equivalent wealth.