Have Starfleet ever been mentioned to have LOST a war though? I can't think of any examples!
If they had, we'd probably be seeing programming about the victors. After all, TREK is not & never shall be GALACTICA.
I'm pretty sure they lost to the Romulans and were forced to sign the Treaty of Algernon -- agreeing not to develop cloaking devices -- as a concession to keep the Empire from overrunning some disputed colonies near the border.
I also happen to think that Starfleet was getting whipped by the Cardassians for whatever reason and the Federation decided to cede a bunch of Earth colonies to the Cardassians in the DMZ exchange rather than commit larger material resources to a controversial border dispute; in that case, they didn't loose so much as not-win.