Adventure Time. We often hear characters singing jaunty, cheerful songs at inappropriate times- such as very suspenseful scenes. In "Beautopia,' when the team is on their way to rescue the last possible humans alive from terrible monsters, we have Jake's jaunty Dixieland diddy, "I'm On A Boat." And it comes right out of nowhere. "Ooooh, I'm on a boat with a couple of wackos, Shaking mah hips and dippin' mah fat toe in the wadaaah... Dippin' in the waddah, this party's gettin' hottah, It's so hot it's stupid!"
In Lemonhope Part 2, Princess Bubblegum is singing a cheerful tune talking about how Lemonhope will be the savior of his lemon people, only for the song to be done over Lemonhope walking through the desolate ruins of Ooo a thousand years in the future, the Candy Kingdom as a bombed-out ruin of a formerly thriving metropolis, the Ice Kingdom nowhere to be seen, Lemon Castle looking like it was abandoned shortly after Lemonhope left, and him ultimately climbing into a bed after turning off his biosuit, presumably to die from old age.
Sym-Bionic Titan makes use of this in the episode "Lessons in Love", when, while the protagonists are fighting a gigantic alien, an upbeat 80s rock song named "Space Age Love Song" by A Flock of Seagulls plays.
The episode "Elephant Logic" features a happy-go-lucky children's song that plays when the main protagonists are under attack by military soldiers.
Futurama's "Time Keeps on Slipping" has a pretty sad ending, but it also ends with the song "Sweet Georgia Brown", which is not exactly the saddest song in the world. Mind you, Bender was whistling it rather wistfully and slowly, and it had a cool echo effect that made it sound all alone in the universe.
Futurama additionally parodied the one in Dr. Strangelove in the episode "A Big Piece of Garbage" by also playing "We'll Meet Again" when a giant ball of garbage that destroyed another one is implied to eventually come back to destroy the Earth in the same way the first one did.
In The Simpsons "War of The Simpsons", the morning after Homer makes a fool of himself after getting drunk at a party, Marge drags him into the car and puts on a tape of the Mexican hat dance and starts arguing with him, presumably so the kids can't hear them. However, they're staring out the window...
Bart: They're fighting in the car again. Lisa: That music always sends a chill up my spine.
Done again in Homer's hallucination in the episode "The Fat and the Furriest". Where the Intensive Care Bear puts on Mexican Hat Dance just before all the bears prepare to tear him apart.
This also shows up in "Trash of the Titans". After Homer crashes a U2 concert and rushes the stage, the band's security guards drag him backstage and give him a Jumbotron-projected beating as the band plays "(Pride) In the Name of Love".
In "Mother Simpson" Mr. Burns starts playing "Ride of the Valkyries" on his cassette player for a raid on the Simpsons home only for it cut to "Waterloo" by ABBA—which Smithers taped over the original recording—and they commence without turning the music off.
An in-universe example comes when Otto proposes to his girlfriend while playing "Every Rose Has Its Thorn"—which is a Breakup Song. Either Otto doesn't realize this or he cared more about playing a song he liked than one that made sense. It's little wonder that their wedding was cancelled with him literally choosing music over her.
In "Marge on the Lam" Ruth Powers prepares for a thrill-seeking night of pushing Marge's boundaries and slams a cassette into her car stereo, only for it to start playing "Sunshine and Lollypops". She quickly corrects it to the intended song - "Welcome to the Jungle". Later on Chief Wiggum also sets up some music for a gritty car chase, and again comes up with "Sunshine and Lollypops". In this case this is apparently the exact song that he intended.
The episode "You Got F'd in the A" had a particularly hilarious usage of the trope: all through the episode, Butters has nightmares about the last time he tap-danced (he accidentally killed eleven people). At the end, he pulls through and joins the dance group for South Park: he tap dances fine, until he accidentally kills their opponents. This means the South Park boys win and he is hailed as a hero, all while crying "No... no... NOOOOOO!" The same song plays both in his flashback and the end credits: a cheery, if somewhat Double Entendre-laced jazz song, "There's Something In My Front Pocket".
Professor Chaos' pitiful attempts at committing evil are only made all the funnier by the genuinely sinister and dramatic orchestral Leitmotif accompanying his schemes.
Drawn Together uses this trope quite frequently, especially in montages. Examples include the happy lighthearted tune that plays while the human race is being wiped out by aliens in "Dirty Pranking No. 2", and the song "Winner Takes It All", which understandably plays during Captain Hero's big AIDS-Walk competition... while he is brutally murdering all of the participants.
One of the happiest, cheeriest themes heard frequently throughout the series is a upbeat flute-played tune that would be right at home in a circus... which also happens to be The Joker's theme music. He sometimes whistles it.
The Penguin's theme sounds nasty and threatening...which is a bit strange, since this version of the character is quite soft-spoken and at times Affably Evil - not the quacking maniac we remember from Burgess Meredith and Danny DeVito portrayals.
Poison Ivy's theme is soft, dreamlike and chimey. This is a woman who regularly murders people in the most sadistic ways she can think of.
There's also the episode "The Forgotten." Gotham City is a steel-clad, faux-1940s metropolis, so you'd expect to hear overly dramatic classical music (which we do) or else jazz and/or showtunes (which we sometimes do). But in this episode the action shifts to some sort of arid, rocky landscape out west (could be South Dakota, or maybe Wyoming) so that Batman can capture some Corrupt Hicks who have kidnapped and enslaved homeless people in order to mine gold. The hicks' theme is as "frontier" as all-get-out, with rapidly-played harmonicas and a booming basso guitar straight out of a Western movie.
The early Joker episode "The Last Laugh" has a rather minimalist soundtrack: a drum machine straight out of a really dark hip-hop video, with the Joker's regular theme interrupting throughout. It's actually very unsettling.
"Baby Doll" has a bright and happy TV sitcom theme playing at certain points. But then we learn that the star of the show has become a psychopath.
Happens sometimes during The Backyardigans. A cowboy episode set to hip-hop, or an Ancient Greece episode set to samba, are such examples of that.
Courage the Cowardly Dog is very fond of this trope. One memorable example involves peaceful nature music being played while savage vegetable-piranha hybrids began to rip each other apart as their gooey remains splattered across the room. Another episode played the same music as the title character is tossed off a cliff.
In the episode of Arthur where Buster comes back from being absent for half a season and finds himself locked out from everyone, the guest narrator, a singing moose played by Art Garfunkel, sings at one point (in a happy upbeat tone) "He's a sad, sad bunny/ A sad, sad bunny..." to which Buster yells "Hey, that isn't sad music!". The narrator quickly changes his tone and tempo to a depressing one.
9: "Somewhere over the Rainbow" plays while 5 is desperately trying to escape a huge and psychotic robot.
Made all the more disturbing when it cuts back to the others still playing happily, while in the background you can hear 5 screaming for help.
The Street Fighter animated series episode "The Medium is the Message" features a slow build to an upbeat, heroic fanfare. Said fanfare plays while M. Bison is exclaiming his joy at what he thinks is the heroes' imminent doom.
The Venture Bros. is known for using this trope quite often in several moments in the show.
Phantom Limb murdering a customer of his by electrocution, set to classical piano music.
In "I Know Why the Caged Bird Kills", Dr Orpheus and Myra are fighting each other while Dr. Venture is in the car with acoustic guitar music playing on the radio.
Dr. Orpheus's has overly dramatic background music that will often play when he makes an entrance.
In the Ben 10: Ultimate Alien episode "It's Not Easy Being Gwen", Gwen's friend Emily play's Chopin's Fantasie-Impromptu while Ben, Gwen, and Kevin defeat Dr. Animo. That's five minutes of laser beams and explosions set to classical piano music.
At the end of The Transformers episode "The Golden Lagoon", as Beachcomber sits glumly staring at the beautiful lagoon a recent battle destroyed and laments "We won..." while the other Autobots celebrate more typically, the standard cheery and upbeat-sounding "Autobot Victory!" music plays.
A humorous example occurs in the Rocko's Modern Life episode "Pranksters": When Heffer's rocket makes its way to China, Scottish bagpipe music plays in lieu of Chinese music.
A very good example is the end of the short film Alma. The character has her soul transferred into a doll and another doll is made for the next victim. All of this is scored to very cheery music.
The song in Tarzan that is sung over scenes where Tarzan's parents and Kala and Kerchak's biological son are both killed by a leopard. It's an upbeat song by Phil Collins. To its credit, it does slow down at the appropriate moment.
From American Dad!'s episode "The Kidney Stays in the Picture": "Before you can react, a man in a ski mask'll tie you to a chair with an Indian braided belt he got on vacation in Santa Fe. He'll turn on some Huey Lewis...and then cut the damn thing out with a rusty keyhole saw!"
The Tiny Toon Adventures cartoon "Out of Odor" ends with happy upbeat music. While Elmyra might have liked the ending, Fifi didn't and noted it stinks.note Bear in mind, though, that it's the same upbeat music that's played at the beginning of some episodes, including the one that some fans claim "Out of Odor" takes place before: "Hare Today, Gone Tomorrow".
El Manana by Gorillaz is a slow, peaceful song, and the video for it has Noodle sitting on a windmill in the clouds, surrounded by greenery and looking pretty chilled out. Then helicopters arrive and start shooting at her, sinking the island and apparently killing her. Cloud of Unknowing, whilst being very sombre in tone, also has a very violent video.
In Blue Cat Blues, an old Tom and Jerry cartoon, the music is the gentle, endearing sounds of a past age you'd expect from Hanna Barbera 'toons of the day. Even the maudlin pieces sound more cute than tragic. The piece opens with Tom waiting for a train as he sits on the tracks, heartbroken over a woman. Jerry narrates, and refuses to help Tom, his best friend in this 'toon. He even says, "For the first time since he met her, I suppose he'll be happy.... I suppose people will say I should have helped him, I know, but it's better this way." Cue flashbacks to Tom's failed romance, which drives him to drink milk. Jerry later finds out his girl married another, and joins Tom on the tracks. Tom makes room for Jerry to commit suicide right next to him. Cue train whistle, fade to black, and cheery outro music. That's right, a blatant reference to alcohol abuse and a double suicide in a Tom and Jerry cartoon. Go see for yourself.
An absolutely glorious example of this in Invader Zim: In the second episode, Bestest Friends, the titular invader attempts to befriend a human in order to appear more normal. Cue a dastardly montage of Zim abusing said friend set to the most ridiculously upbeat score of music possibly ever composed. It must be heard to be believed.
The opening of Sonic SatAM: Bafflingly, it depicts Robotnik's conquest and roboticization of Mobotropolis while a Bragging Theme Tune keeps going on about how cool and fast Sonic is.
In the episode "Future Vision", Steven's panicky imagine spots about the various ways he could get killed are accompanied by a jaunty jazz piano tune called "Death Rag".
In "Gem Drill", Steven and Peridot are drilling down to destroy the Cluster. When Steven announces he wishes he'd brought music with him, Peridot puts on incredibly cheery elevator music. That's right before the drill is attacked by Gem mutants.