The Ambush on Thanos was a semi-successful planned attack organized by the Avengers aimed at reversing effects of the Snap by retrieving the Infinity Stones from Thanos. Unfortunately, Thanos had destroyed the Stones to avoid temptation, rendering the goal impossible and forcing the Avengers to settle for the hollow victory of killing the Mad Titan.
A few weeks after the Snap, Thanos destroyed the Infinity Stones on the Garden, nearly killing him as a result. Unbeknownst to Thanos, the usage of the Infinity Stones was detected by the Avengers, who used the Benatar to fly to the Garden to take the Gauntlet from him and bring back the victims of the Snap.
Emerging from the Universal Neural Teleportation Network, Captain Marvel exited the Benatar and flew down to the Garden taking reconnaissance, informing the other Avengers that there were no defenses in place on the planet.
On the planet's surface, Thanos was picking crops from his field, before going in and preparing a stew to eat. As he sat down in his hut, he was suddenly blasted by a photon blast from Captain Marvel before she burst into his hut and put him into a headlock. Bruce Banner in the Iron Man Armor: Mark XLVIII bursted from the floor further restraining him, with War Machine joining and holding down Thanos' other hand. Thor then flew in and sliced off Thanos' left arm with Stormbreaker, releasing the Gauntlet and causing great pain to the Titan. Then Captain America, Black Widow, and Rocket Raccoon enter the hut, and Rocket flips over the gauntlet, and they were all shocked when they saw that the stones were no longer in the gauntlet.
Under interrogation, Thanos revealed that his most recent usage of the Infinity Stones had been to destroy them, ensuring that they could not be tempted to use them again and undo the Snap. Knowing full well that his genocidal actions couldn't be undone, Thanos waited for the Avengers to decide his fate. The Avengers initially believed Thanos to be lying, to which Nebula replied that while her adoptive father was many things, he was not a liar. Thanos thanked her for believing him and finally admitted that perhaps he had treated her too harshly. Before he could say anything else, an enraged Thor decapitated Thanos, killing the Mad Titan. When Rocket asked what he had done, Thor replied that this time, he went for the head.
Still being affected by Thanos, Thor, after rebuilding Asgard on Earth, went into a state of complete exile and depression, only coming out for more beer. Over the next five years, he would gain serious weight and convey a chilled attitude, while still be haunted by his initial failure to stop Thanos, and then the proceeding failure to retrieve the Stones and killing Thanos out of revenge.
In 2023, Scott Lang was released from the Quantum Realm and came up with the idea of using it to travel to the past and retrieve the Infinity Stones from specific points in time to bring everyone back. This led to the execution of the Time Heist, which involved the reassembling of the Avengers who had gone their own ways after their defeat in 2018.
During the Time Heist, when Nebula traveled back to 2014 to retrieve the Power Stone, a recording she had saved on Thanos' final moments was played by the Nebula of that time, revealing to that Thanos his destiny.