FIFA World Cup: Netherlands 2 Mexico 1
Leading 1-0 with two minutes remaining in Fortaleza on Sunday, Miguel Herrera's men stood on the verge of reaching the last eight of the tournament for the first time since 1986, having exited in the second round in each of the past five finals.
However, substitute Klaas-Jan Huntelaar played a leading role in turning the game on its head, setting up the equaliser for Wesley Sneijder in the 88th minute before converting a stoppage-time penalty after Rafael Marquez was adjudged to have brought down Arjen Robben.
It meant heartbreak for Mexico, who had taken the lead through Giovani dos Santos' fine strike three minutes after half-time, and for long periods it looked as though the Dutch were wilting in the scorching 38-degree (100 Fahrenheit) temperatures.
But Huntelaar, introduced in the 76th minute to replace Robin van Persie, headed Robben's corner into the path of Sneijder to rifle home.
The Schalke striker then sent Guillermo Ochoa the wrong way from the spot to seal Netherlands' passage to the quarter-finals and ensure Mexico's last-16 curse was extended.
Van Persie returned from a one-match ban and slotted straight back into Louis van Gaal's starting XI. Van Gaal was forced into a change in the ninth minute when Nigel de Jong was replaced by Bruno Martins Indi, although signs of any injury were unclear.
Mexico, who had Carlos Salcido back in place of the suspended Jose Juan Vazquez, had the first sight of goal in the 17th minute when Hector Herrera fired wide of the left-hand post from just inside the area following good work from Oribe Peralta.
Miguel Herrera's men felt they should have had a penalty shortly afterwards, but Ron Vlaar's high foot on Hector Herrera went unpunished by referee Pedro Proenca.
Salcido then tried his luck from 30 yards in the 24th minute, his rasping drive causing Jasper Cillessen to move to his right and parry the ball behind for a corner.
Van Persie had Netherlands' first half-chance three minutes later, bringing down a ball over the top before firing into the side netting from an acute angle with his weaker right foot.
Following the first of two cooling breaks in which the players took on fluids to combat the searing temperatures, Mexico went close again just before the interval, Dos Santos seeing his effort saved by the legs of Cillessen.
The Dutch were denied a penalty of their own in stoppage time, Robben going down under a challenge from Hector Moreno, but once again the match official waved play on, with the latter carried off on a stretcher following the incident.
Mexico made a flying start to the second period, Dos Santos lashing a bouncing ball into the bottom right-hand corner from 25 yards three minutes after the restart.
Peralta threatened a second eight minutes later, but Cillessen was equal to his curling effort from just outside the box.
Netherlands came close to an equaliser in the 58th minute, but Ochoa made a superb reaction stop from Stefan de Vrij, tipping the ball onto the post after the defender met Robben's corner four yards from goal.
Sneijder then saw his 18-yard strike deflect narrowly over the bar.
Ochoa was called into action again in the 74th minute, rushing from his line to deny Robben as the Bayern Munich man bore down on goal, while Vlaar headed the resulting corner over the bar from six yards.
Then came the late drama.
Sneijder thumped a low shot beyond a motionless Ochoa before Marquez's trip on Robben handed Huntelaar the chance to clinch victory and inflict further heartache on Mexico.