I could possibly be wrong, but in the dungeon crawl mode, it appears that the game over from reaching 0hp triggers before the staff of resurrection restores your life total on reaching 0%hp. I had only just nabbed the staff of resurrection before entering the final level, so I'm 99.9% sure it had not been triggered prior to the dragon.
Hopefully I reported that with enough detail, but continue making such great games! They have kept me entertained for many a boring day waiting for my wife to finish her internship.