It's been said that The Joker, written properly, should frighten you one minute, have you laughing the next, then hating yourself once you realize just what you're laughing at.
The last two pages of The Widening Gyre. Batman has just opened up to a new hero, unveiling himself as Bruce Wayne, and introducing the man to his fiance, and the hero, who's already revealed himself to Batman earlier, takes his own off for all of them to go have breakfast and talk like normal people. Next page, the "hero" pulls down his real mask and slits Bruce's fiance's throat as he reveals that he is Onomatopoeia
Another example is from the novel "A Death in the Family" when Jason Todd finally meets his long lost birth mother and they have a heartwarming reunion when suddenly The Joker arrives and forces her to betray him by handing Jason over to him where the Joker thrashes him within an inch of his life with a crowbar then leaves them locked in a warehouse triggered to explode, and they both die.
Part of Battle for the Cowl starts with Damian taking a Batmobile on a joyride with a goth/punk girl he picked up, before Oracle takes over the controls and ejects the girl from the passenger seat in a panel played for laughs. Then, about two pages later, Killer Croc tackles the Batmobile and belches up the girl's shoe, thanking Damian for the "snack".
Cue Dick coming to save the "Brat" and the two momentarily joking about Damian's earlier predicament, only for them to suddenly get blasted out of the air and Dick to fall unconscious, causing Damian to panic and scream fro Dick to wake up. Oh, Mood Whiplash indeed!
Paul Cornell's Batman-spinoff Knight and Squire miniseries is mostly played for whimsy and laughs. There's a superhero milkman, a secret society of ninja Morris Men, a clone of Richard III who tries to topple the monarchy by taking over Twitter and Youtube. The last story is about Jarvis Poker, the British Joker, a harmless old prankster going on a crimeless crime spree, complete with singing fish and sneezing-powder getaways. Knight and Squire are letting him continue as a last hurrah since he's dying of cancer. Then he gets cornered by the Shrike, a hot-blooded young superhero who hasn't got the memo, and The Joker turns up, shoots Shrike dead, and embarks on a killing spree.
One of the better known issues of Fantastic Four featured Sue Storm having complications during her pregnancy. They decide to engage Doc Ock, appealing to his intelligence and so forth, and have a typical superhero-on-supervillain battle at one point, only to return to find that they were too late, and Susan already miscarried.
Nite Owl's snow suit. The story in general is depressing as hell, but....when he puts on that ridiculous fluffy white coat, it's hard to take it seriously.
The best part? It's (of course) an owl-suit.
Double freakin' Happiness. Starts off as a light Fish out of WaterSlice of Life story. Then, just as the protagonist starts to fit in and gets a date with a cute girl, he gets cornered in an alley and gets beaten to a bloody pulp by hoodlums. Worse, he realizes why this happened: all his new friends are Tongs—rivals of the gang that beat him up.
Keith Giffen and J.M. DeMatteis' Justice League International was a very good example, where a comedic quip, a Deadpan Snarker, or a hilariously drawn expression by Kevin Maguire would come out of nowhere in a dramatic scene. Issues ranged from pure comedy to action/drama at will.
Dead@17 ends its rough cut arc, which is a flashback involving child abuse, torture, demons, and a sociopath murdering a bunch of people, with an 11 Omake made by three artists. The middle one especially is a series of 3-4 panel strips staring the main character and her best friend (who split up in the previous arc after said friend was brutally tortured for her connection to the main character) making light of the zombies who killed half their town and the main character's status as undead.
"The Slavers" from The Punisher MAX was an incredibly dark, depressing story where Punisher tried to tackle a real-world problem and, ultimately, failed. So, to lighten the mood a little, Garth Ennis brought in the most outrageous and over-the-top villain in the MAX universe: Barracuda. While it was hardly a Disney movie; a mercenary with gold teeth that read "FUCK YOU" who likes pancakes and sea shanties is considerably cheerier than gang of slave traders who brutalize young girls and kill infants.
In issue #5 of The Sandman, a relatively light story involving the Justice League, Silver Age villain Dr. Dee escapes from Arkham Asylum and gets a ride with a passing motorist. She's initially terrified, but Dee looks harmless and frail, and soon the mood relaxes and they are chatting amiably. At the end of the story she lets him out at his destination, telling him sincerely to take care of himself...and he casually kills her. The next issue, "24 Hours", is one of the most nightmarish stories in the entire Sandman run.
Whedon's run on the Astonishing X-Men saw Kitty put on a ten mile long bullet shaped bus, effectively dead, but Beast was told by the half-alien head of Sentient World Observation and Response that she needed him to check her judgement on the job, and wanted to break him like a pony off the job, and that his blue furry monsterdom was not a turn off to her. Also that she was half alien.
The Spider-Man comics and sagas live in this trope.
The french fantasy serie Les Légendaires is a devoted adept of the trope: there are so many times the story switches between silly and serious moments that it's hard to count them. Most notably, almost all story arcs started with the protagonist being portrayed as incompetent heroes that get themselves embarrassed while fighting some minor treath, only to be then thrown into some major treath and proving them competent. Most notable uses of the Trope include :
The First book is quite much of a joke almost all along, until its end who leaves a Sequel Hook by revealing Elysio, the mysterious amnesiac kid who was travelling with the Legendaries is actually Darkhell, the Legendaries Arch-Enemy. In the next book, we learn that a whole group of heroes, including protagonist Danael's Big Brother Ikael, have been turned into monstrous beings in an attempt to get the Stone of Crescia the Legendaries were trying to get. Then all Legendariesbut Danael dies trying to get the Stone, only to have the demonical Evil Sorcerer Skroa take it away from them. Though they recover, the book ends with a hint that Elysio drank a memory potion and became Darkhell again.
Book 3 and 4 switch several times between the comical theme of the Legendaries trying to team up with their rival team the Fabulous, Shimy arguing with her mother about her being part of the Legendaries and the darker theme of Elysio trying to stop Darkhell from destroying the Elven World and Alysia because he feels guilty for all the evil Darkhell did; all of this with a vicious war between Elves and Pirahni.
Even more extreme when Fabulous member Shaki reveals he has already met with Darkhell, was the one who gave him his scar on the cheek and wants revenge for Darkhell murdering his entire tribe. A truly dark and serious part... if you exclude the fact Darkhell reveals Shaki's real name is "Little Cat Drinking his Milk Bowl", causing the warrior to get hightly embarrassed.
Book 5 starts dealing in a comical way about Danael's and Halan's rivalry for Jadina's heart. Then we learn Halan was so eager to win he actually teamed up with the vicious Pirate Captain Cedeyrom in a scheme involving Time Travel to prevent the Legendarie from ever existing. When the Legendaries attempt to follow them in Book 6, it ends up with all of them but Jadina dying again, though Jadina is able to reset time so the whole episode never happened to begin with.
Book 7 starts with the Legendaries trying to stop a ridiculously arrogant villain named El Diablo from stealing a potion, then introduce the Gods Dawn and Dusk who state they are gonna destroy all Alysia if the Legendaries aren't able to turn everyone back to normal before a given time. Follows until Book 8 a very serious plot involving more informations about Gryf's species and the Fantastic Racism they are the target of, as well as Skroa manipulating the heroes and killing from cold blood several people for his schemes.
The Anathos Cycle was probably the most extrême case: Book 9 starts with Darkhell attacking Prison Barek and slaughtering mercyless the guards in order to free his daughter Tenebris, then switch to the Legendaries enjoying a swim in a lake. They are then thrown in one of the darkest storyline in the whole comic; Book 10 switch from the Legendaries arguing with Each other in a comical way, then each couple confessing their love to each other, only to have the God of Evil Anathos winning a few pages later and defeating all the Legendaries, leaving them horribly crippled. While the two last books are serious the same way, it also has Jadina making a fool of Anathos by Out-Gambiting him.
There's an issue of Cable & Deadpool where Deadpool is having a mental crisis. It's Deadpool, so of course he's going to make you laugh. But, then you feel bad about it realize that you just laughed at a guy who's seriously having a mental breakdown over all the people he's killed in the past.
The first issue of the Anya Corazon Spider-Girl series plays like a Spiritual Successor to lighthearted teen superhero like Young Justice. Then on the last page her father is killed. The second issue is all about her grieving.
Transformers: Last Stand of the Wreckers: The Wreckers break into the prison and confront Overlord. Rotorstorm cracks a joke, "Wreckers Combine!" Then a Beat panel occurs when no one laughs, but soon, Overlord himself starts chuckling, amused by the joke, immediately after that he points his gun at Rotorstorm's head and blows the bot's cranial fluid all over his companions.
The follow-up Transformers: More than Meets the Eye has even more. The series drifts between comedy, drama and horror. Issue 6 has Swerve going into his various funny ramblings, and it ends with him accidentally nearly killing the ship's psychologist with a laser. In issue 12, two Decepticons, Blip and Nautilator, have a friendly conversation with Blip remarking that Nautilator sounds like Megatron and should say "something Tyranny"; cut to later in the issue where Nautilator is begging for his life at Autobot Whirl's feet, who tries to do an Optimus Prime impersonation with Nautilator's Megatron before blowing his head to pieces. The series also features a drink namedropping this trope.
Issue 15 may be the worst offender yet, with Swerve cracking a Fourth Wall breaking joke panels after Ultra Magnus being fatally wounded
The kingdom of chaos, third book in Thorgal: Louve series ends on lighthearthed note, with Thorgal's daughter defeating evil wizard and safely returning home, having learned important lesson. Then she catches her mother in bed with another man, finds out Thorgal is dead and has her first pieroid, all in span of the last two pages.
The end of the Italian comic "Un Polpo Alla Gola" (An Octopus to the throat) The main characters' theories are proven to be just childish delusions, and they redraw closer to their ex-teacher. Then we found out the truth about the skull, the finding of which started the whole story: it was the school janitor's childhood buddy, a little street thug. He pushed the janitor's Berserk Button by making fun of being attached to an old toy (it was a gift from his mom, who left him and the husband); the janitor in response pushed him off a staircase. He didn't got up.