I have had this happen as well. It appears that the end of the Turn, the one that the Hero dies, doesn't actually End until the Leveling up action is completed.
It should be considered a BUG and fixed but am unsure exactly how that mechanic works at this time.
It does SUCK, at least the first couple of times, to think your whole crowd survived the raging battle, only to find yourself down 1 or more characters, upon completion of level up. 