Happens all the time in Hellblazer; it's a fact of the protagonist's life that he never has any permanent, unequivocal victories.
Done on a universal scale by Reed Richards. Reed learned some time ago that Galactus' existence, however problematic, is necessary to the universe. He tried to get around the problem by turning Galactus into a star. In mainstream continuity, this still ends up releasing Abraxas. In Earth X, it frees up the Celestials to overrun the universe (because what Galactus was really eating was their young, which gestate in planetary cores — then hatch).
Done a lot in the Byrne Era of Fantastic Four. The only characters who don't mess up royally are Sue and Johnny. For example: Reed invents a portal to the Negative Zone. He then takes Sue, Johnny, and Ben to the Negative Zone for a long time without even considering the fact he didn't even program the portal to only recognize them, and not allow anyone else in. Oh, not only that Reed never once considers asking the Avengers to watch over Alicia and Franklin in the Baxter Building, leaving them completely and utterly defenseless in case of an attack. The result? Alicia and Franklin are nearly killed by Annihilus, half of the Baxter Building is destroyed, and Annihilus almost destroys New York yet again. And...no one calls out Reed that stupidity. Not even Sue!
Another point: Thing decides, against all logic, to stay on the planet where Secret Wars takes place. He returns months later, learning Alicia had moved on and fell for Johnny (which was mutual). Ben, I love you, but come on, you ABANDONED your blind girlfriend after she had been fucked up by Annihilus to stay on Secret Wars' planet due to your self-centered body issues. And you expected her not to move on?
In Jenny Sparks: The Secret History of The Authority, we find out that a thirteen-year-old Jenny Sparks convinced a friend in Vienna that he was wasting his life making paintings that didn't sell and suggested that he'd find another profession.
Jenny Sparks: There must be something you can do. You're patriotic, well-read and an excellent communicator. Have you ever considered a career in local government? Do I even have to say it?: Politics? Actually, that might not be such a bad idea.
This happens at the very beginning of the French comic book series Les Légendaires. The Five-Man Band confronts the Big Bad and foils the plot that should grant him eternal youth... but in doing so, they shatter the magic stone he was using, which results in a supernatural discharge that turns not only the heroes but all the adults on the planet into children. (As well as the denizens of the near-by Elfin World parallel dimension.) Unfortunately for the protagonists as they struggle to correct their mistake, their responsibility in this mess is common knowledge. Needless to say, they aren't very much welcome anywhere after that.
In an early Avengers issue, the team has come to a military base to locate the Cosmic Cube, an all-powerful wish-granting machine. They find Prince Namor the Sub-Mariner trashing the place for unrelated reasons. During the fight, Hercules tells Namor they'll never let him get the Cosmic Cube. Namor promptly escapes, leaving Hank Pym fuming — he's guessed (correctly) that Namor had never heard of the thing until Herc told him. Naturally, Subby finds the Cube and comes back to mop the floor with them.
Another Green Lantern example: When the Corps executed Sinestro in Green Lantern Corps vol. 1 #222, Sinestro transferred his soul to the Central Power Battery and imploded it from within (rendering almost all of the power rings powerless, with the exceptions of Hal, Guy and Ch'p), and that's when he discovered the yellow impurity (if we go by current continuity, that yellow impurity is Parallax).
In Booster Gold vol. 2, when he goes back in time to save his friend Ted Kord, the second Blue Beetle. He succeeds, but since Ted's death is the nudge that brought the other heroes into action barely on time for the events of Infinite Crisis, his salvation results in the heroes failing to act on time, leaving the world in ruins and under Max Lord's domination.
Almost and sort of happened in the Rock of Ages storyline in JLA. As Superman and the other mainstringers of the JLA go after Lex Luthor, who has acquired the Philosopher's Stone and formed his own Injustice Gang, it is revealed to Green Lantern, Flash, and Aquaman that the JLA will eventually defeat Luthor and the Gang, and Superman will destroy the powerful Stone... which will somehow cause Darkseid to conquer the Earth. They even get a firsthand experience of that dark (pun not intended) future. This future is averted when they get back barely in time to give Martian Manhunter a warning for him to stop Superman from destroying the Philosopher's Stone.
Definitely happened in the Midsummer's Nightmare storyline (which caused that JLA incarnation to form in the first place): after foiling the Big Bad's plan, he explains he only did it to prepare humanity for a worse threat Mageddon that was still to come.
In the JLA's battle with the invincible supervillain the General, Batman tries to use hypnosis to defeat the villain. He does a good job until Superman comes bursting through the wall. Batman even yelled at Supes for the screw-up.
Sleepwalker has just about defeated the ax crazy Psyko and halted his rampage across New York. It's then that he sees a man who's possessed by a demon and uses his warp beams on the man to expel the demon, which provokes a watching Spectra to attack him. While Sleepwalker defends himself from Spectra, Psyko seizes the opportunity to escape and continue running amuck through New York. Fortunately, Spectra later fixes her mistake when she helps Sleepwalker bring Psyko to justice once and for all.
This is the premise that kicks off I Hunt Monsters, when Willam Warlock inherits a graveyard that acts as a Sealed Evil in a Can to powerful monsters his ancestors trapped there. However, because no one told Will about this beforehand, when it comes time to recharge the obelisk keeping the monsters dormant, he refuses to believe what's going on and declines to help. Say the least, he regrets that decision a moment later when the monsters free themselves and go to wreak havoc across the world.
Raven screwed up big time in Teen Titans. During the one-year Time Skip (long story), she spent several months working on bringing her old friend, Joseph Wilson, back to life. She succeeded, and what was the first big thing Joey did after returning from the grave? Tried to murder the Titans. Thanks, Raven. What would we do without you?
Another Teen Titans example is when Damian joins the team. The Titans are fighting a rampaging teenage psychic. Raven is able to calm him down. Then the Boy Wonder kicks him, pissing him off even more.
Also happens in Marvel's Crisis CrossoverSiege. The Avengers assemble in Asgard to defeat Norman Osborn, reuniting the 'Big Three' of Marvel; that is, Captain America, Iron Man and Thor. Osborn is defeated, but not before having the Sentry destroy Asgard. It then turns out that Osborn was the only one who could control the Void, the Sentry's evil side, who, as the president was informed, "has no limit to his powerset". The Void is then shown preparing to kill them all.
In a six-issue miniseries about Mara Jade, By The Emperor's Hand, Mara is sent to go assassinate a gang leader, and she does, then gets rewarded for a job well done. Only to find out, months later, that she'd killed a decoy, effectively faking his death and giving him that much longer of a reign.
For that matter, after the Emperor died Ysanne Isard, Director of Imperial Intelligence, pulled a Nice Job Breaking It Villain. She'd known Mara was an agent of some sort for the Emperor, but little more, and she'd been highly suspicious of her - so after the Emperor's death, Isard locked Mara up, thus turning her against the Empire.
An older (timeline-wise) example. The Jedi were so desperate at the Battle of Ruusan they were giving nine and ten year old children enough Force training to be dangerous, shoving lightsabers into their hands and sending them to be cannon fodder (Seriously, are we supposed to see the Jedi as good guys?!) One of those ten year olds falls out of an airship, apparently to her death...only to survive and be found by Darth Bane. Congratulations, your child conscript is the next Sith Lord!
At least two or three of Batman's rogues have been created this way as well, mainly by accidentally causing their downfall (at least one of the Joker's Multiple Choice Past stories have him being scared by Batman and then either falling or jumping into the chemicals that result in his current look, and in some adaptations of the Riddler's backstory, it's implied he once worked as a game programmer before Bruce Wayne fired him), both in the comics as well as in various adaptations of the comics. Nice job breaking it, Dark Knight.
Cassie from Crossgen Publishing's Route 666 may have managed to give Congress a glimpse behind The Masquerade, revealing the SovietRodinan ambassador as a literal monster and thereby striking a small blow in her fight against The Legions of Hell... but she apparently didn't anticipate that doing this at the height of the Cold War would be a perfect way to push the world right to the edge of nuclear war.
In thisChick Tract, the protagonist's aunt, who is a conservative Christian, and thus has an interest in seeing her nephew be saved, dies and leaves him all of her money. Unfortunately, said nephew hears the news right after he was witnessed to by another Christian and seriously considering conversion. It turns out that he was only interested in Christianity because he thought it was a way out of the poverty he had stumbled into, so he decides not to accept Jesus, and that night, he dies and goes to hell.
In G.I. Joe Vs. Transformers 2 the United States government decides to just nuke the heck out of the bad guys (who had all gathered on one island). Turns out nukes plus Energon, the highly-volatile substance that Transformers run on, equals Earth-Shattering Kaboom. Two heroes, Wheeljack and Mainframe and one villain, Doctor Mindbender, decide they want to live and stop the nukes by making a Kill Sat. Which then fries Mercer, a prominent good guy. Oops. The trio then has to break the Kill Sat, which fortunately doesn't cause any more innocent deaths.
Barry Allen decides that he doesn't want his mom to be dead anymore. So, he goes and chases Professor Zoom and stops him from killing his mom. End result? Flashpoint Oops.
He did this literally, on a smaller scale, in one issue of his original run. The Mirror Master falls in love with a woman trapped in a mirror, and tries to rescue her by tricking the Flash into taking her place. Barry realizes he's being sucked into the mirror—and shatters it, which traps her forever. Oops.
The Mighty Thor: In-universe, almost everyone considers Thor bringing back Loki (after he died in Siege) to be this. Loki was, however, brought back as a kid without any of his former emotional baggage (this was discovered to be one last shot at redemption/something like that by the original Loki). The trope's been subverted because so far the kid has one goal in mind: save Thor from the Serpent (and he if saves Earth too, then that's great!).
Plus, Thor insists that the real Nice Job Breaking It, Hero was how all of Asgard treated Loki as a villain because that's how it was written by the Norns, and therefore he became the villain they scorned him as. The main argument Thor has for keeping Loki alive is that with the Ragnarok cycle broken, even Loki has a chance to be good, and not have his fate predetermined.
Virtually the entirety of John Stewart's career consists of careening from one such moment to another. From getting his sister killed in a car accident to the destruction of two planets, John has pretty much the highest kill count possible while still being called a hero.
The recent Sonic the Hedgehog storyline had Dr. Eggman initiate Operation: Clean Sweep, a Cosmic Retcon that SHOULD have erased Sonic. Instead, it turned Mobius into its video game counterpart. Sonic turns Super Sonic and tries to reset things. However, because he wanted to save Sally from being killed, doing so futzes up reality, including reallowing roboticization, restoring Ixis Naugus' other personalities, restoring Bunnie Rabbot's cyborg limbs to flesh and bone, causing Antoine to be critically injured, the Freedom Fighters to break up, and worst of all, giving Sally A Fate Worse Than Death - becoming Mecha Sally.
Long before this, Locke wanted to prepare his son Knuckles for a horrible threat he sensed in a premonition. To prepare, he did genetic experiments on himself, so Knuckles would inherit the genes, and and exposed Knuckles egg to Chaos energy from the Floating Island's emerald. While this gave Knuckles more potential than any previous Guardian, said power was stolen by Mammoth Mogul, causing a chain of events that nearly destroyed the multiverse.
Like father like son, however Knuckles has 3 if not 4 occasions:
After heavily damaging Robotropolis during Mecha Madness, Knuckles stuns Robotnik with a headbutt and explains how he survived before flying himself and Sonic back to Knothole, instead of just finishing Robotnik off right after the headbutt. Robotnik was able to rebuild and eventually set up the "Endgame" arc.
As Chaos Knuckles he tried to use time travel to reunify his people, preventing the Dark Legion from forming. However he failed each time, his last attempt would've gotten his people roboticized. He never realized that he could just stop Robotnik from rising to power in the first place with time travel and save his people. And considering how he knew the origins of quite a few villains by this point, one could say that Knuckles is to blame to the book's villains.
As Enerjak he destroyed Eggman's base and his air fleet. Bizarrely, while he did use his powers to kill Kage, and realized that his people's problems led back to Eggman, he once again never thought to kill Eggman. Eggman rebuilt what was left in the aftermath into the second Death Egg.
Hell, it runs in the family! The Brotherhood of Guardians had a major tradition not to interfere with anything unless it actively threatened their interests. During the last year or so of Robotnik Prime's reign of terror, he found the Floating Island, weaponized it, tried to crash it onto the Great Forest, and crashed the first Death Egg into it and tried to sink it into the ocean. Not once did they raise a finger to stop him. Even more, they didn't raise a finger to stop Enerjak, the Dark Legion, Mammoth Mogul or Dr. Eggman when he was at his weakest. Because of this, when Sonic was presumed dead, Eggman was able to catch up technologically, ally himself with the Dingos, and invade Angel Island, bringing down Echidnaopolis and allowing Dr. Finitivus to ambush and imprison the Brotherhood in the Twilight Zone.
Avengers Vs X-Men: The Avengers manage to disrupt the Phoenix Force before it can possess Hope... only to split it into five units, which then possess Cyclops, Namor, Emma Frost, Colossus (who was already possessed by the Juggernaut!) and Magik. Yeah, that'll work out...
It actually does work out great, the Phoenix-possessed X-Men then proceed to use their new power for the greater benefit of all mankind, solving world hunger, making deserts bloom, bringing free clean energy to every corner of the globe and even bringing about an end to war... then Avengers decide to attack them again.
Scott Pilgrim has a very literal example of this in the fifth book: While performing at a concert live, Scott is attacked by another one of the Twins' robots. Scott deals with it easily enough; by smashing its head off with his bass guitar. Unfortunately, the bass is also destroyed in the process, which effectively puts Scott's band out of commission.
Then it turns out that the bass was actually on loan from Scott's younger brother.
And Said younger brother comes back to reclaim the bass at the end of the book.
Justice League: The Rise of Arsenal became less about Roy Harper's downward spiral in anti-heroism following the death of his daughter Lian and his dismemberment by Prometheus, and more about what happens when you neglect a friend when he needs you most. This was due to the astonishingly half-assed approach his friends and family took when trying to help him.
Actually, Kid Loki's entire run is a breathtaking example of this trope in action. Mostly powerless and mistrusted by nearly everyone, Loki's only recourse to solving the problems he encounters is to knowingly and willfully break other things. The final conflict is, essentially, everything he's done catching up to him.
In Matt Fraction's 2011 The Defenders series, the heroes accidentally meddled with one of the Concordance Engines — mysterious artifacts that keep the 616 universe running as it should — in the very first arc. The rest of the series involved them learned how badly they'd messed everything up, and eventually Doctor Strange had to go back in time and retcon their mistake (and the whole series) out of existence.
The events of Death Of The Family are this: Bruce Wayne, early in his career, confronted the Joker after he's first incarcerated and makes the mistake of giving a hint of who he is to the Clown Prince. Cue a few years later in-series, and the Joker decides to destroy Batman's family and bring everything back to square one. Oy, Bats...!
Then, there's War Games. Stephanie Brown, pissed off at being used by Bruce, decides to use one of Bats' contingency plans to gather up all of the gangs. However, she had no idea that Batman was actually needed for this part. End result? All of the gangs killing themselves, leading to a massive power vacuum that ends up with Black Mask in charge.
The Skrull prince Xavin put a great deal of effort into guilt-tripping Karolina Dean into leaving the Runaways and becoming his/her bride in hopes of ending a war between the Skrulls and the Majesdanians that had been sparked by Karolina's evil parents. But their betrothal actually ended up re-igniting the war and making things worse.
For someone calling himself the Superior Spider-Man, he's sure doing a great job messing things up. Let's see here:
He actively attacks The Avengers when they worry about him, then put him on probation when they can't really find anything wrong and suggest he's just taking things a tad too far.
After obtaining his own mercenary force and obtaining the Raft to turn into Spider-Island, he invades Shadowland and apparently kills Wilson Fisk. Not only is Fisk not dead, the Green Goblin swoops in and gathers up what remains of Fisk's forces to become the Goblin Kingpin of Crime.
When he's searching for the new Hobgoblin, he goes so far as to reveal the man's identity to the entirety of New York. With nowhere left to run, the man finds himself running into the loving arms of, you guessed it, the Green Goblin.
His ultimate breaking? Erasing Peter Parker's memories from his mind. In his attempt to prove that he's better than Parker in every way, he eradicates what seemingly is what's left of Peter's memories. End result? When Horizon Labs is on the verge of being destroyed and another hero, Spider-Man 2099 attempts to save the day, SpOck promptly knocks him out, then attempts to save the day himself. Because he erased Peter's memories, he's trying desperately to find one of Peter's memories before he's blown up temporarily and, thanks to a bit of a time glitch, loses about nine hours of life. Thanks to this, Horizon Labs is gone, he's lost his job, Spidey 2099's stuck in the past... oh, and Peter's coming back.