The Kim Possible movie A Sitch in Time explores this possibility with a Bad Future if Shego were ever to seize control of the world.
Sort of hard to believe if you haven't seen many of the shorts, but Tom and Jerry actually has a few episodes in which Tom wins. One example is the short "SouthboundDuckling", which ends with Tom covering himself and the vulnerable mouse and duck, implied to do... something to them.
"The Bodyguard" also ends with Spike back in the Dog Pound and Tom allowed to chase Jerry all he wants. Around a dozen instances exist with Tom getting the last laugh, even if the majority of other examples were more karmic, with Tom being non provocative or Jerry taking his retribution to far too gratuitous levels to be considered "the good guy" anymore.
Elmer beat Bugs in a few other cartoons and is happy about it. One cartoon has Elmer (who has gone crazy and thinks he's a rabbit) trick Bugs into switching places with him at a hospital. Bugs is then drugged into thinking he is Elmer and decides to go hunting for rabbits. Elmer is in a rabbit suit doing to Bugs what Bugs usually does to him. At the end Bugs is arrested because the police think he's Elmer, and Elmer owes a ton of back taxes. After Bugs is carried away Elmer dances off into the sunset. It's revealed to be a Batman Gambit and Elmer was only Obfuscating Insanity.
Elmer: I may be a scwewy wabbit, but I'm not going to Alcatwaz!
The last cartoon in which Elmer beat Bugs is when Elmer controls Bugs in Rabbit Rampage in a way resembling how Bugs controlled Daffy in Duck Amuck.
Inverted in three cartoons Bugs, where he's the bad guy, raced a turtle called Cecil who came out on top every time. He is the ONLY person to go up against Bugs and always win! Until the episode "Customer Service" in the second season of The Looney Tunes Show, where Bugs finally one-ups him by using every trick he's got.
If Failure HeroDaffy Duck ever donned a hero gimmick and was without his Hyper Competent Sidekick Porky to pick up the pieces, it's likely to happen as well. Particular examples include "My Little Duckaroo", which ends with western convict Nasty Canasta brutally beating him off screen and "Golden Yeggs" where he is captured by Rocky the gangster and forced to lay endless golden eggs. Curiously both instances were before said villains were paired against Bugs, with them having a much more sinister presence compared to their later appearances.
Special mention goes to the full version of "Duck Dodgers and the Return of the 24th and a Half Century", in which Marvin the Martian is finally able to activate his explosive space modulator. With the bumbling Dodgers distracted elsewhere and Earth's destruction imminent, Marvin is left to inform the viewers "It's only a cartoon". This was oddly cut from the shortened theatrical version.
Also special mention for the manager of the Broken Arms Hotel in "Porky Pig's Feat". One of the few characters to outsmart Porky, Daffy, and Bugs.
In Yogi's Space Race, Phantom Phink and Sludge won most of the races (sometimes in their disguises). They're prompty dismayed when the prizes turn out to be rubbish.
Transformers: Beast Wars. occasionally ended some conflicts in victory for the Predacons, and the Maximals lucky to get out alive. This was especially true in the Season Finales. Season 1 with Megatron sabotaging a makeshift spacecraft, thereby turning Optimus Primal's risky ploy into a suicide mission. Season 2 ends with Megatron shooting the original Optimus Prime in the face, causing time and space to warp so that the Decepticons won in the original series. This gets a hasty fix at the beginning of season 3, but there is probably nothing more bone-chilling than the Big Bad pointing at the camera and telling the heroes "YOU NO LONGER EXIST!", especially when the show could have easily been canceled afterward. Only the third finale, which also ended the series, ended with a Maximal victory.
It was short lived. The sequel series Beast Machines sees the Maximals being graceless winners by chaining Megatron to the outside of their spaceship in the finale of Beast Wars biting them in the ass immediately. He gets free, gets through the time warp they were taking to return home first, and because of the Timey-Wimey Ball, he had all the time in Cybertron he needed to take over the planet with a virus from season 1 of Beast Wars, doing what no other Megatron could do in successfully winning it all alone.
Subverted in the 10th anniversary episode. Mojo Jojo finally achieves his goal of ruling the world and promptly goes about instituting world peace, giving everyone puppies, etc., leaving the Powerpuff Girls in shock. Mojo soon grows bored, though, and resumes his evil ways, thus enabling the Powerpuff Girls to, once again, save the day.
The time-travel episode featuring HIM.
Also, HIM once challenged the girls to solve a series of riddles they had to solve on time or Professor Utonium would have to "pay". They were a few seconds too late, which forced Professor Utonium to pay for... the pancakes he ate at HIM's diner. The narrator, who usually ended each episode by saying the day had been saved and told who saved it, was at a loss for words this time.
And there's the Series Faux Nale "See Me, Feel Me, Gnomey", in which the girls are defeated in the beginning of the episode.
This actually happened a few times on Codename: Kids Next Door, in episodes such as "Operation: P.R.E.S.I.D.E.N.T.", "Operation: S.L.U.M.B.E.R.", and "Operation: S.I.X.".
Batman Beyond had at least two occasions of bad guys winning: in "Ascension", Paxton Powers tricked his father out of the way so he could take over Wayne-Powers Enterprises and; in "Inqueling", Inque's daughter steals her money albeit it's left unclear if Inque ever tried to extract a payback.
As shown in the picture above, a Bond-style super villain takes over the East Coast at the end of The Simpsons episode "You Only Move Twice". The only "loss" for the "good guys" is that the Simpsons family had to move back to Springfield because no one was happy in the "perfect" neighborhood they had set up in. To rub salt in the wound, Homer was given his life's dream: ownership of a football team... Sadly, that football team was shown to be the worst in the league at the time.
The Boondocks episode "The Itis" ended with Ed Wuncler Sr. obtaining Meadowlark Park once Robert Freeman's now-closed soul food restaurant he dreamed of for so long lowered the park's property values to make it easier for Wuncler to purchase despite him being more than rich enough to purchase it to begin with.
The "Stanley's Cup" episode ended with the pee-wee hockey team Stan is coaching being savagely and utterly destroyed in their game against the Detroit Red Wings. The episode ends with the Red Wings excitedly celebrating (the Coach's father even tells his son he loves him in a parody of cliche sports movie endings) while the boy's friend Nelson dies from leukemia and "no hope".
"The Return of Chef", which sees the Super Adventure Club successfully corrupt Chef into becoming a child molester.
"Casa Bonita" involves Cartman succeeding in getting invited to Kyle's birthday dinner. When they arrive at Casa Bonita, Kyle's mother gets a call on her cell phone, hearing that Cartman is responsible for Butters' disappearance. Cartman rushes inside and hurriedly does everything he wanted in a span of less than a minute before the authorities arrive.
Officer: Well, kid, you made an entire town panic, you lost all your friends and now you're going to Juvenile Hall for a week! Huh, was it worth it? Cartman:Totally.
In the Black Friday Trilogy, Bill Gates and Niles Lawson (the reporter).
The Classic Disney ShortChicken Little (not to be confused with their movie of the same name) ends with Foxy Loxy eating Chicken Little and all of the chicken of the farm, and collecting their bones. The Narrator laments "Hey, wait a minute, this isn't right. That's not the way it ends in my book!", and then Foxy, while playing with the now dead Chicken Little's Yo-Yo, taunts him "Oh yeah? Don't believe everything you read, brother!" Considering that this was a Wartime Cartoon acting as a parable to Adolf Hitler's tactics, the message is clear.
One of the interesting aspects of Adventures of the Galaxy Rangers was the sheer number of times that the Rangers' "victory" was merely getting away with their skins. The pilot was especially brutal. Zach's kids get away, but only because of Eliza's Heroic Sacrifice. Zach is gravely wounded, the bad guys get away clean, and the Queen's raid on Kirwin has netted her several dozen humans.
A few Private Snafu shorts end with Private Snafu being killed. At least one ends with him put in a Nazi prisoner of war camp under watch of a gloating German soldier. But since this is a Wartime Cartoon with the intent of showing American soldiers how NOT to act, it's justifiable.
A few episodes of Jimmy Two-Shoes end with Lucius having the upper hand, including "There Will be Chocolate" and "Catalog of Misery".
ReBoot Season 2 ends with Megabyte sending Bob into the Web and beginning his real attack on the city. Later in Season 4 Megabyte also takes over the Principal Office and the series ends with a Bolivian Army Ending.
Captain Planet and the Planeteers has the notorious "Whoo Gives a Hoot", which is the only time this happens. The Planeteers attempt to stop Looten Plunder with a court injunction against clear-cutting an old growth forest. Despite their success in finding what they need to stop the cutting, Looten's clumsy, stupid minions actually managed to succeed in stealing the evidence, leaving Plunder free to continue. The Planeteers and judge eventually discover Looten's deception, only to discover that Looten had already cut down all the trees. What makes it worse is that the episode ends on that note. In other words, Looten gets away with not only destroying a protected wildlife area, but he also manages to get away with defrauding the government. Not only that, he laughs in their faces about it and dares them to try and stop him again.
Several episodes of Xiaolin Showdown end in the bad guys winning, such as Wuya getting all the Shen Gong Wu, getting all of them the very next episode too, Bigger Bads being released into the world, teammates turning to the dark side, etc.
The first season of Titan Maximum ends with Gibbs succeeding in bringing down the solar shield around Mercury, with the team able to do nothing but stand there looking shocked.
Also unlike spoiler:Cameron, Lightning refuses to share the money with the contestants in the season, so that he can use the money to build a stadium just so he can practice for his career, that's right he keeps all of the prize money to himself, making every contestant in the season upset, especically Jo, who the most upset.
Jo:(Confessional) I carried both of those maroons to the finale! Where's MY million dollars? What a ripoff!
Futurama likes this trope and has had allusions to evil ruling for stretches of time in the future past. But a current continuity example has bitter, demented Nixon (yes, that Nixon) winning the presidential election at the last minute and storming into the White House in his giant robot body causing carnage and destruction to the tune of Hail to the Chief.
"Less Than Hero" works the same way: the good guys are forced to steal the Quantum Gemerald for the Zookeeper to free Leela's parents, and since they're Brought Down to Normal, they can't go after him. Like the above example, they don't even really seem to care much. Bender and Fry even walk off talking about bluffing their way through some super-villainy of their own (while the public still thinks they possess powers).
Another notable episode is Decision 3012 where the gang help an opposing candidate beat Nixon in the presidential elections Said candidate was a time traveler from a bad future where Nixon's rule resulted in robots uprising and destroying humanity so he had came back in the hope of becoming Earth's president to avert it. By winning however his future and thus his existence was erased, allowing Nixon to win unopposed. And the real gut punch was that Bender, who was against the new candidate, knew all along that this would happen.
The first episode of Hurricanes had the Garkos Gorgons sabotaging the Hispanola Hurricanes by having several of their players injured before their upcoming game. In order to have a full team, Amanda Carey, the Hurricanes' owner, disguised herself as a male so she could play at the game. The Hurricanes won 3-2 but her conscience led her to confess, which led to the Gorgons being granted official victory.
This episode was intended to be the season finale, as they weren't sure if they'd get brought back for another. When it was revealed American Dad! would get another season, it became the premiere instead.
Roger deserves special mention for the episodes "Ricky Spanish" and "Love, American Dad Style".
Bat-Mite (who generally isn't a bad guy, but made a Face-Heel Turn in one episode) from Batman: The Brave and the Bold comes to believe that the show has jumped the shark, and tries to get it cancelled so it can be replaced by a Darker and Edgier Batman cartoon. Since this happened during the series finale, he succeeds. While Bat-Mite does suffer for this by getting erased from existence (he's too silly a character to work in a dark and realistic cartoon, so he unintentionally dooms himself by destroying the show that actually suits him) he takes his fate surprisingly well. This even applies out of universe: Brave and the Bold is being replaced by a Darker and Edgier Batman cartoon, at least by comparison.
Subverted earlier in the episode "Joker: The Vile and the Villainous!" where Joker, wanting to help his mentor, the Weeper (who'd come close to destroying Fawcett City thirty years earlier, but was bested by Bulletman) regain his villainous touch. In this case, it was The Joker who was portrayed as heroic while Batman, who wanted to thwart them both, was seen as the villain.
The first episode of the second season of My Little Pony: Friendship Is Magic, The Return of Harmony: Part 1, ends with Discord breaking and brainwashing the most of the Mane (Except for Twilight) cast and winning his own maze game by having Rainbow Dash break the rules and fly away, causing the maze to sink. Discord then unleashes chaos on Equestria, resulting in possibly the biggest Downer Ending in the series.
The season 2 opener of Scooby-Doo! Mystery Incorporated is both Downer Ending and this trope combined, Daphney doesn't come back to the team, Hot Dog Water replaces her, Fred's plan to capture Crybaby Clown fails, and the entire town of Crystal Cove is covered in flames, kind of a way to start the season on the wrong foot.
Code Lyoko, similarly to Beast Wars, had several cases of the Lyoko-Warriors failing at their current goals and XANA actually emerging victorious:
Seasons 1 ends with XANA causing Aelita's materialisation to partially fail by keeping her dependant from the Supercomputer, thus preventing the heroes from defeating him once and for all.
Seasons 2 ends with him actually succeeding in his goal to leave the Supercomputer and reach the Internet, a plan he had been working on since the beginning of the season, with the Lyoko-Warriors being only saved from permanent failure by a Deus ex Machina from Franz Hopper.
Season 3 ends with XANA actually succeeding in destroying Lyoko (though Jeremy rebuilt it in the next season).
The second season of Avatar: The Last Airbender ended in a horrible defeat for the good guys. AzulakillsAang before he can go into the Avatar State, then proceeds to conquer Ba Sing Se with her recently face heel-turned brother Zuko, and forced our heroes into hiding. Aang only manages to survive thanks to a Chekhov's Gun from the first episode of the season, but has lost the ability to access his Super Mode. The later episode "Day of the Black Sun" also ended with the Fire nation capturing the adults, forcing team Avatar to escape. Unlike the former episode, there is one good thing that came from this. Zuko pulled off a Heel-Face Turn and leaves the Fire Nation.
A one-episode villain in season 3, Hama, wants to teach Katara bloodbending (the art of water-bending the fluid inside another human being), regardless of whether or not she actually wants to learn. In the end, Katara is forced to use the technique, and Hama, despite being arrested, cackles madly at her success while Katara breaks into tears.
In the first book of The Legend of Korra, Amon has a extremely progressive lead on the heroes in the first few episodes. Korra confronts him in the fourth episode, but it doesn't end well. She's only spared because he wishes to save her for later. In the sixth episode, titled "And the Winner Is...", he stages a successful attack on the Pro-Bending finals after arranging for security to be at its maximum — just as planned — and he doesn't let up from there...
In Episode 10, Amon and his followers conquer Republic City by quickly and decisively neutralizing the leading politicians and police force leaving the city without leadership and defenseless. Tenzin gets away, but he's still forced to flee to keep his family safe. Lin also gets de-bended after refusing to tell Amon where Korra is.
Yakone. His plan for revenge on Republic City and the Avatar was to raise his sons as bloodbending Tykebombs. His eldest son Noatak betrayed him and he died thinking his revenge would never be fulfilled, but in the end his plan actually worked. Tarrlok, his youngest, went on to, for all practical purposes, take over Republic City and, while not intentionally, helped tear it apart socially and physically along with his brother, who was now known as Amon.
In the plot of Book 2, Unalaq's plan succeeds which relied on having Korra open the portals allowing Vaatu to be free by Harmonic Convergence. Then Vaatu when on to get his revenge by ripping Raava out of Korra and killing the spirit.
Samurai Jack: Episode VI: "Jack and the Warrior Woman." After finally finding a surefire way to get back to his own time, Jack is aided by a mysterious female ally in reaching it. But it turns out that she's actually Aku in disguise the entire time who was using a cover so Jack would lead him to this. Aku destroys Jack's escape, reveals himself, laughs in his face about it, and takes off before the samurai can attack him.
For that matter, the first episode. The whole series takes place in a distant future (from Jack's POV) where Aku has already taken over the world after defeating Jack in the past (by throwing him into the future). Jack's quest is to find a means to return to the past and undo this victory.
The second season finale of Transformers Prime: The Decepticons create a fortress on Earth, from which they launch a full-scale assault on the Autobot base. Wheeljack is shot down by Starscream, while the other Autobots and humans flee through the GroundBridge, just before the Nemesis obliterates the entire mountain... with Optimus still inside.
Portia, Gwen, Penny, Mary Gibbons and Anton St. Germain in some episodes of The Mighty B!.
Several episodes of Star Wars: The Clone Wars end with this trope. Some of these episodes include Cloak of Darkness, Gungan Attack, Hostage Crisis, Heroes on Both Sides, Slaves of the Republic, and the Netflix-exclusive episode, Orders.
The Light of Young Justice winds up winning most skirmishes with the team, even/especially the ones that look like a clear-cut victory for the good guys. Then comes the series finale, where half the Light is captured, but the rest wind up in a better position than they started in, including the Big Bad Vandal Savage who has a War World, an alliance with Darkseid, and has accomplished every goal he wanted.
Tomatoes! Tomatoes! Putrid T. Gangreene and his Killer Tomatoes gain total world domination! (Well, at least for a few episodes of the series. And somehow the Prof. doesn't seem to be happy with the new situation either.)
In "Dreamscaperers", the penultimate episode of season one of Gravity Falls, Gideon ends up successfully stealing the deed to the Mystery Shack, and the episode ends. Fortunately, things turn around by the season finale.
The Mid-season finale/Series Faux Nale episode of Grojband, "Six Strings of Evil", has Corey breaking free from the Guitar, but the Dam gets destroyed and all of Peaceville with it.
The Online Exclusive episode "Girl Fest" has Laney delivering a blow to her former role model Candy Jams in the form of a song as an attempt to call her out as a "Fake" , unfortunately for her it fails and people still give Candy their full support.
Kate and Allie also suffer no consequences for kidnapping Grojband and keeping them hostage in "Group Hug", unless you count Mina angrilly tackling them, considering that they also kidnapped Trina.