The Ambush on Thanos was a semi-successful planned attack organized by the Avengers aimed at reversing effects of the Decimation 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-at-best victory of killing the Mad Titan.
A few weeks after the Decimation, Thanos destroyed the Infinity Stones on Titan II, 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 Titan II to take the Gauntlet from him and bring back the victims of the Decimation.
Emerging from the Universal Neural Teleportation Network, Captain Marvel exited the Benatar and flew down to Titan II taking reconnaissance, informing the other Avengers that there were no defenses in place on the planet.
On the planet's surface, Thanos is picking crops from his field, before going in and preparing a stew to eat. As he sat down in his hut, Captain Marvel shoots him with an photon blast before bursting into his hut, placing him in a headlock. Bruce Banner in the Iron Man Armor: Mark XLIX burst 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 Decimation. 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."
However, five years later, Scott Lang was released from the Quantum Realm and came up with the idea of using it to travel to the past, retrieve the Infinity Stones from specific points in time and reverse the Decimation. This led to the execution of the Time Heist.