Igor Akinfeev's mistake proved costly as Mexico came from behind to beat 10-man Russia 2-1 to book a place in the Confederations Cup semi-finals and send the hosts crashing out.
Stanislav Cherchesov's side needed to win to qualify for the knockout rounds from Group A but despite scoring the opening goal Russia self-destructed by conceding two terrible goals that gifted Mexico victory.
Russia had seen two penalty appeals rejected before taking the lead after 25 minutes, Alexander Samedov finishing well from inside the box after Aleksandr Erokhin teed him up following a miskick.
The lead was short-lived, however, with Mexico swiftly equalising through a Nestor Araujo header, the centre-back directing a header past Russia's goalkeeper Akinfeev, although he did not seem to be going for goal.
And Mexico went on to take the lead in even more bizarre circumstances early in the second half, with Akinfeev completely misjudging a long ball and presenting Hirving Lozano with a simple headed finish.
The Video Assistant Review (VAR) system denied Mexico a third when Hector Moreno was correctly ruled to be offside but, after Yuri Zhirkov was dismissed, El Tri held on to stay in the tournament and knock Russia out.
Lozano was making his first appearance of the Confederations Cup and he had the first shot on target after five minutes, cutting inside off the left wing but shooting too close to Akinfeev.
Zhirkov was denied a penalty when he went down under Moreno's challenge and the former Chelsea winger then fired narrowly wide of the far post as Russia threatened.
Russia had another appeal for a spot-kick but referee Fahad Al Mirdasi consulted with the VAR after a delay and the Saudi official subsequently decided Araujo had not brought down Fedor Smolov.
The hosts' pressure soon told, though, as the opening goal arrived after 25 minutes.
Smolov had cracked a drive against the post but Russia did well to keep the threat alive and when the ball was worked to Samedov he slotted a neat finish across Guillermo Ochoa into the bottom-right corner.
Mexico were level within five minutes, however, as Araujo looped a header across goal that deceived Akinfeev and nestled into the net.
Erokhin immediately wasted a fine chance to put Russia back in front, blazing over the crossbar, and Samedov was denied his second goal of the game by a raised offside flag.
Mexico went ahead seven minutes after the break, Akinfeev making a calamitous decision to come for a long ball and missing it, allowing Lozano a simple finish.
Moreno then side-footed past Akinfeev but VAR saw his goal disallowed and Russia were reduced to 10 men when Zhirkov caught Miguel Layun with a flailing arm and was shown a second yellow card.
Igor Smolnikov had Russia's best chance to level, smashing over from close range, but the hosts could not produce a comeback and will not participate in the semi-finals, with Mexico progressing alongside Portugal from Group A.