Portal 2: The Unauthorized Musical: At the end of "If You Could See You", a cheery instrumental reprise of the song is played while Caroline is dragged off to be forcibly put into GLaDOS, struggling and screaming.
In the stage version of West Side Story, Maria sings "I Feel Pretty" after the rumble scene, and before she finds out Tony killed her brother, and "Gee, Officer Krupke" is also sang after the death of Riff. Both songs were moved to before the rumble in the movie version.
Cabaret introduces its upbeat title song immediately following a scene where one of the main characters gets beaten up by Nazis.
The opening number, "Willkommen," evolves into this song. At the top of the show, the Emcee sings "Welcome, stranger — happy to see you, stay!" in 3 languages, all chirpy and everything, while the girls on stage entice the men in the audience, apparently enjoying the spectacle just as much as the Emcee is. This lasts until the very last version of the song — in which the girls are jaded, low-energy, bruised and beaten, their clothing torn, and the Emcee has become practically malevolent. It's a commentary on the "mask of normalcy" people are wearing during the Nazi occupation, and if you know it's coming, it makes the song a lot less chirpily cheerful during the opening.
Another example from Cabaret is "Tomorrow Belongs to Me", the upbeat opener sung by a bunch of young people about how the future's going to be great. Then you realize it's being sung by the Hitler Youth.
Most of the score of Sweeney Todd: The Demon Barber of Fleet Street, whether it's the "Johanna Sequence", where Sweeney sings a tender ballad of paternal love as he slits throats, "God, That's Good", wherein Mrs. Lovett, Toby, and a slew of "satisfied" customers sing about how great the meat pies are, or "A Little Priest," a cheery waltz about Mrs. Lovett's... ideas.
The "Johanna Sequence" is an odd example, given that Sweeney's lines are about how he doesn't really care what happens to his daughter anymore — a song about how he's basically losing his humanity while he murders people isn't quite as strange. The song/action combination is still dissonant, though.
It's not that Sweeney doesn't care about Johanna any more, it's more that he's growing resigned to the fact that he can never be her father... almost a lament for the fact that he's lost her. So not too dissonant really...
Adding onto the fact that he feels it would be too painful to love, or even see her, because she would remind him too much of Lucy.
Urinetown: The Musical features a few of these, including:
"Snuff That Girl" a cheerful number about how the resistance is going to get captured eventually, so they might as well off the Big Bad's daughter and have some fun. (Fitting, as it's a parody of the gang songs of West Side Story.)
But even more ironic is the finale, "I See A River." It begins as a cheerful song about the triumph of the poor until Officer Lockstock comes on stage and reveals that by removing the restrictions on restroom use, the town's water reserves have been exhausted, thus dooming everyone to die of thirst. Shortly after this revelation, the song transitions into the Recurring Riff from the first number of the show.
Officer Lockstock: Like I said, Little Sally, it's not a happy musical.
Little Sally: But the music's so happy!
In the second act of Hair, the cast members act out increasingly violent situations in which everyone is "killed." Afterwards two cast members sing a peppy musical version of Shakespeare's "What a piece of work is a man" speech over the stage strewn with dead bodies.
In Vanities: A New Musical (Pasadena Playhouse and ACT versions), the finale ultimo song "Letting Go" is sung during/immediately after Mary's mother's funeral.
In the final act of Jez Butterworth's Jerusalem, a sexually abused May Queen orders ex-daredevil and local bad influence Rooster Byron to dance with her. They get interrupted by her stepfather and brothers, who beat Rooster to a pulp inside his trailer, brand him with a poker, and leave him bleeding on the floor. All this is set to Fairport Convention's wistful "Who Knows Where the Time Goes?"
The finale of the original London production of Miss Saigon had mournful music playing over the scene as Kim prepares to say goodbye to her son Tam. This abruptly segues into a reprise of the raucous, upbeat song "American Dream", which culminates in the sound of a gunshot—Kim has fatally wounded herself.
"Lovely Ladies" is an upbeat, innuendo-filled about the horrors of prostitution.
"Master of the House" and its Dark Reprise "Beggars at the Feast" both apply; the former is about how the Thenardiers scam their inn's patrons out of their money, and the latter is about how they're both Karma Houdinis who, despite being by far the worst people in the entire show, they come out of it the best: rich, happy, and alive (which is a lot better than most of the show's characters can say). Both songs are Played for Laughs and the happiest, most fun songs in the entire show.