Hello, I am sorry for this issue. I will try to spread awareness that this is a bug that happens when you combine switching moves (Like saphirr's talonflame's u-turn) and stealth rocks. What happened was, talonflame died on rocks, and it counted the battle as a loss for you.
For now, avoid using Rocks against him, while we work on a fix.
~DP~