It's because Life Orb damage is calculated last (in the series of the overall damage events).
When we calculate the damage caused during the course of a turn, the direct damage is calculated first, and after that the indirect ones like from Life Orb (as in the replay), Rough Skin etc. Therefore, as Kingler survived a Psychic and killed the Alakazam with Life Orb, the recoil got activated after Alakazam died, so the opponent won. But, say, if the opponent died from Explosion, then you'd win the battle, but if the opponent dies from Life Orb after knocking out your Pokémon, they'll win.
Hope it helped!