If there's one thing that generations of cinema have taught us, it's that audiences love a happy ending. People love to see a hero overcome tremendous odds to get the victory they deserve, and a triumphant ending is such a standard part of the Hollywood formula that a fake-out happy ending that turns dark at the last minute has become a trope in and of itself.

Lots of films have delighted in surprising viewers with shockingly dark endings, so it's arguably even more daring when the opposite happens. Audiences can generally tell how a movie will end by its tone, so they are in for a shock when a relentlessly bleak story turns out alright for the protagonist, or when a downer ending subverts itself to end on an upbeat note.

28 Days Later

Jim, Selena and Frank in a corridor in 28 Days Later

Danny Boyle's 28 Days Later is a modern horror classic, helping revitalize the zombie subgenre for the 21st century and largely putting Cillian Murphy on the map. Given that zombie movies often end with most or all of the heroes getting killed, it must have been a pleasant surprise that Jim, Selena, and Hannah all survive to see the end.

RELATED: 10 TV Characters Who Didn't Deserve Their Happy Ending, According To Reddit

In this case, the happy ending that fans got was the result of test audiences disliking something much darker. The original plan was for Jim to die, which would've been more in keeping with zombie films' penchant for downers, but may have been a step too far for viewers who had grown to care about Jim and wanted his suffering to mean something.

A.I. Artificial Intelligence

Haley Joel Osment and Jude Law in A.I. Artificial Intelligence.

A.I. was Steven Spielberg's effort to bring Stanley Kubrick's last project to the screen. It's a sci-fi adventure that also asks tough questions about what it means to be human, earning it a strong fanbase that considers it a love letter from one auteur to another.

Kubrick's frequent depressing conclusions may have led his fans to expect that the movie would end when David's battery is depleted, but the kid actually gets to live out his happiest day with a reconstructed version of his adopted mother. This arguably makes the film Kubrick's most sentimental work, a far cry from his usual cold, clinical, and bitterly cynical fare.

Arthur

Arthur and Linda smiling in Tootsie

Arguably Dudley Moore's most lovable film, Arthur was the highest-grossing comedy of 1981 as well as a hit with critics. While a happy ending for a mostly lighthearted comedy wouldn't ordinarily come as a surprise, the film gives audiences a bait-and-switch to make them think it's headed for more bittersweet territory.

Just as it looks like Arthur is going to abandon his vast fortune to live the working-class life with Linda, his grandmother Martha insists that this will not do for any family member of hers, and he gets his $750 million. It may not be a realistic ending, but it's perfectly in keeping with the film's tone and Arthur's personality.

Back To The Future Part III

Doc Brown bidding farewell to Marty and Jennifer in Back To The Future Part III

The Back to the Future trilogy is iconic and beloved by generations of fans, and Part III ended it on quite the high note. Combining the first two films' sci-fi comedy with a western setting, the movie is filled with great humor and adventure and ties up Marty and Doc Brown's story in a satisfying, touching way.

RELATED: 10 Happy Movies With Surprisingly Dark Endings

In another fake-out, it at first appears as though Doc is stuck in 1885, but then he, Clara, and their two kids show up in a time-traveling train, showing that they can come and go through time as they please. It may have been a brave choice to have Doc stay in the past knowing he can't go back, but it's nice to see him triumphant after all the struggles he's been through.

Edge Of Tomorrow

Tom Cruise Edge of Tomorrow

Critics and audiences alike fell in love with the most beloved alien invasion films ever. What made the movie so compelling was seeing Tom Cruise play against type as William Cage, who goes from a self-serving coward to a true hero, even in the face of certain doom.

The climax sets up Cage as a goner, with his route to resurrection in case of death cut off and his fight against the Omega being a certain suicide mission. But just as he's about to die, he absorbs the dead Omega's blood, ensuring he and all of his companions survive in a reset timeline, an appropriate ending for a movie with plenty of comedy to go along with the action.

Godzilla Vs. Kong

Godzilla vs Kong

A battle royale between two iconic movie monsters, Godzilla vs. Kong assured fans that only one could walk away from their epic battle the winner. With how often the "it's a tie" cop-out is used in movies like this, it was actually quite surprising that Godzilla clearly beat Kong, even leaving him on the verge of death with severe wounds.

However, the two team up when Mechagodzilla emerges as a bigger threat, allowing the movie to have a happy ending that Kong's death would've rendered impossible. In doing so, the film can have it both ways, offering a clear answer of who would win to fans who might've expected nothing, while still having them both survive as heroes (as much as monsters like them can be).

The Jerk

Steve Martin in The Jerk

The Jerk may be over forty years old, but Steve Martin's first starring vehicle still holds up as one of his funniest, it's the story of a lovable idiot trying to make something of himself and get with the woman of his dreams. While the movie ends happily, with Navin's family and love interest Marie bringing him to his new, upscale home, it throws viewers for a loop before getting there.

RELATED: 10 Movie Endings So Bad They Ruined The Film, According To Reddit

The story goes through a rags-to-riches-to-rags, with Navin becoming fabulously wealthy until a lawsuit leaves him homeless and destitute. While most would expect that to set up a happy ending in a comedy like this, the tone is irreverent enough, and Navin jerk-ish enough, that a played-for-laughs downer ending would've been convincing.

Moonlight

Kevin and Chiron kiss

While coming-of-age story focusing on a gay black man, it's also a serious, somber film, making it easy to expect a downbeat ending.

After a lifetime of hardship including child abuse, homophobic bullying, and desperate drug dealing, Chiron reconciles with his mother and may be on the way to rekindling his relationship with Kevin. It's the perfect type of happy ending for a hard drama, one that's heartwarming without being too sentimental, giving it a realistic feel that goes along with the rest of the movie.

Searching

John Cho in Searching

A movie set entirely on computer and phone screens has no business working as well as Searching, an engaging mystery with lots of unpredictable twists and an excellent star turn by John Cho. With a tense plot centered around a father's search for his missing daughter, anyone could be forgiven for expecting a tragic ending.

RELATED: The 10 Best Movies With Unsettling Endings That Will Haunt Viewers

This seems to be what's in store when an ex-con confessed to killing protagonist's David's daughter Margot, but David's discovery of a certain photo leads him to realize that Margot is alive, resulting in her rescue. The details may be a bit silly, but it's a unique reversal of the usual situation where a positive development gives way to a cruel twist.

What We Do In The Shadows

The vampires in What We Do In The Shadows

Many viewers may have been introduced to the world of the acclaimed TV show, but the Taika Waititi-helmed film is what started it all. It's a dark, witty mockumentary that gives an early indication of its director-star's talent, and its ending is a great example of how to turn tragedy into farce.

The film's climax features the apparent death of the lovable ing character Stu at the hands of a pack of werewolves, and the protagonists grieve for him accordingly. But just as it looks like the movie is over, it turns out that Stu actually survived as has been turned into a werewolf, letting it end on an upbeat note.

NEXT: 10 Movies That Subtly Spoil The Ending Early On