A Pyrrhic victory is a victory which was won with devastating cost to the victor. The phrase refers to the ancient King Pyrrhus of Epirus, who had won battles against the Romans while suffering devastating casualties. It would later come to refer to any situation where the victory was ruinous to the victor.
Even though Captain Picard was victorious in the Battle of Maxia, it was a pyrrhic victory in that the USS Stargazer was so severely damaged that her crew had no choice but to abandon ship. (TNG episode: "The Battle")
During the closing days of the Dominion War, the Female Changeling promised a pyrrhic victory for the allied powers - that the Jem'Hadar and the Breen would fight to the last man, and that they would inflict such casualties that the victory would taste like defeat. Fortunately, she was persuaded by Odo to surrender herself and the Dominion forces on Cardassia, but not before her forces had killed over 800 million Cardassians. (DS9 novelization: What You Leave Behind)