Make no mistake, though Infinity War's ending certainly looks dire, it won't be long before all is resolved. It's likely to come at an immense cost, however, and with the film's two primary influences - Jim Starlin and George Perez's Infinity Gauntlet, as well as Jonathan Hickman et al.'s Infinity - again in the public eye, it might be a good idea to examine how Thanos was thwarted in the comics themselves.
Infinity War (the film) utilises the snap from the aforementioned Gauntlet as a threat from start to finish; Gamora teases it in the film's first act, and Thanos himself speaks of clicking his fingers to wipe out half the universe later on. None truly thought Marvel would come good on their threat however, but with half of Earth's Mightiest Heroes now dead (at least for the time being), people want to know how Thanos comes undone, and while this isn't to say for definite that the comics have the answer (I've taken a stab at that elsewhere), they could hold vital clues as to where the story is heading.
First things first, Starlin and Perez's Infinity Gauntlet has a lot more to play with than its cinematic counterpart. It had three decades' worth of lore to call upon when telling its story, and with that in mind, Infinity War's roster pales in comparison. There are dozens of heroes and villains in this comic, but the two most noteworthy are Nebula and Adam Warlock - the two characters who end up undoing Thanos' happy ending.
Also different is the fact that Thanos, incensed by the fact his love for Mistress Death hasn't been reciprocated, unleashes the snap relatively early on in Infinity Gauntlet's story. The heroes aren't so much traumatised by the loss of life as they are perplexed, and Doctor Strange - together with Adam Warlock (a character teased in the after-credits sequence of Guardians 2), Captain America and the surviving members of Earth's heroes - seek Thanos out to undo the damage he's wrought. They dwell on the event - that much is true - but it's more rousing than destroying, spurring Marvel's characters to give their all to defeat the Mad Titan.
In the ensuing battle dozens of characters - including Captain America - perish. Death betrays Thanos but none prove a match for the Mad Titan, who ascends to an even higher level of omnipotence until Nebula, heavily damaged earlier in the story, swipes the Gauntlet from under his nose. She then embarks on her own campaign of tyranny, forcing Doctor Strange to save Thanos and team up so they can wrest control of the Infinity Gems once more.
The ensuing chaos brings with it even more twists and turns, but it does address Thanos' snap from earlier in the story. Nebula is tricked into undoing all the damage Thanos caused but doing so leaves her in a vulnerable state. The Gauntlet is then stolen by Warlock, prompting further cosmic drama before Thanos seemingly kills himself in space. Warlock then uses his new powers to travel further into the future, discovering that Thanos - rather like he has in the film itself - has settled as a farmer on a faraway planet, content that the power of the Infinity Gems is no longer his to bear.
Could this mean Thanos will willingly undo the damage he dealt in the nineteenth MCU film? Probably not, but it does raise the prospect of Nebula in particular having a major part to play in his downfall, especially when you take into account Gamora's death and the disintegration of the rest of the Guardians, barring Rocket Racoon.
In any case, expect those resurrections to be delayed for much of Avengers 4. The soul stone is likely to feature again, and with the cinematic Thanos being decidedly more dogmatic than his comic book counterpart, don't suspect any team-ups either.
What did you think of Infinity War's ending? Will the comics have a bigger influence going forward? Let us know in the comments below!