Aristotle argues that the ideal tragic reversal involves a character achieving the opposite of what they intended to do as a result of circumstance and their own character flaws. He cites Oedipus the King as an example, but a lot of ancient Greek tragedies involve this trope, often overlapping with Not Quite the Right Thing.
Urinetown ends with the heroes triumphantly toppling the evil toilet monopoly and launching a new era of free urination. Only, as it turns out, the monopoly was right about the water shortage, the newly unrestricted flushing makes the town run dry, and everyone dies of thirst.
Little Sally: What kind of a musical is this?! The good guys finally take over and then everything starts falling apart?! Lockstock: Like I said, Little Sally, this isn't a happy musical. Little Sally: But the music's so happy! Lockstock: Yes, Little Sally. Yes, it is.
The Wild Duck Nice job telling your friend his family's been lying to him all these years. And now his daughter's dead.
Wicked finds Elphaba listing her contributions to this trope in the song "No Good Deed".
Sweeney Todd: The Demon Barber of Fleet Street: If Anthony Hope didn't bust in Sweeney's barber shop in the midst of his shaving of Judge Turpin, his plans to rescue Johanna Barker would have gone according to plan, and Sweeney himself wouldn't have gone off the deep end due to being denied his first shot at revenge.
In Pokémon Live!, Pikachu's Thundershock and Thunder were the last two moves MechaMew2 needed to learn; with the list complete, nothing can stop Giovanni from conquering the world.
In Die Entführung aus dem Serail, the first really German opera by Wolfgang Amadeus Mozart, one can only pity Belmonte. When he's captured along with his bride, he says his father's rich and can give a generous ransom. Only to find out that his father is their captor's bitterest enemy. And for the lady, whose faithfulness, incidentally, Belmonte highly doubts, to learn of her bridegroom's doubtful heredity.
In both The Barber of Seville and The Marriage of Figaro, Figaro's plans tend to go comically awry because of mistakes that either he or one of the other heroes make. The usual culprits are Count Almaviva's hot-bloodedness, a lover or spouse's jealousy, Figaro's Zany Scheme working better in his head than in practice, or all of the above combined. Thankfully, in Barber Figaro's last-minute quick thinking saves the day, while in Marriage the Countess modifies his scheme to make it actually work.