Ties where everyone dies go to the attacker. Ties where neither side is wiped out go to the defender. So if you kill the corsairs in the last round and they kill you with reflect damage in the process, that counts as a win.
And really, even the last opponent in the trainer dungeon is easy. I pull all but one of my generals off of my team to make the battles go faster. I used to use Master Strategist for the last battle, but now I'm using Dragon of Echigo for the last round. I'll probably switch to Saitoh Dohsan for some earlier rounds, as you generally want the weakest general that can one-shot the opposing side in order to make the battles go faster and reduce reflect damage.