Peru's first World Cup win in four decades ensured that they gave their travelling hordes a memory to treasure, while Australia exited the tournament on a day when even a win wouldn't have been enough.
Denmark's draw with France meant that there was nothing Australia could have done even with a victory, and despite controlling possession they lacked quality in the final third against a Peru team who finally found their shooting boots.
Tim Cahill was again left on the bench for Australia, whose only change saw Tomi Juric come in for Andrew Nabbout up front. Ricardo Gareca made two changes for Peru, bringing in Anderson Santamaria and Renato Tapia for Alberto Rodriguez and Pedro Aquino.
The two teams nullified each other for the first 18 minutes, but the first half-chance of the match produced the opening goal. Paolo Guerrero latched onto a long ball, and waited before lofting a pass towards Andre Carrillo, who thunderous volley found the corner of the net. It meant that the Benfica man had the honour of scoring Peru's first World Cup goal in 36 years.
Australia tried to respond but it took them until the 27th minute to force Pedro Gallese into his first save. Tom Rogic weaved through the Peruvian defence and forced a corner with a low shot, although he probably should have squared the ball to the better-placed Juric.
The closest Australia came to an equaliser in the first half was when Robbie Kruse got in behind the Peru defence and tried to slide the ball back to Mathew Leckie, but some heroic defending kept the score at 1-0 and the resulting corner was headed over by Mile Jedinak.
Peru ended the half on top but couldn't add to their lead before the break. With Denmark drawing against France in Moscow, Australia knew that they would have to score twice and hope for a France goal to stand any chance of going through.
Within the first five minutes of the second half, Peru killed the game off with their second goal. Miguel Trauco burst into the box and squeezed a pass through to Guerrero, whose shot took a deflection off Mark Milligan and past the despairing dive of Matt Ryan. It was a fairytale moment for Guerrero, who is Peru's all-time top scorer and might retire after the World Cup.
Australia sent on Cahill in place of Juric for his first appearance of the tournament as they sought a miraculous fightback. The talented youngster Daniel Arzani was also brought on for Kruse as Bert van Marwijk threw caution to the wind.
Aziz Behich had a shot deflected just wide of the post and Cahill saw an acrobatic goalbound effort blocked by Christian Ramos as Australia pushed for a way back into the match. Behich beat the offside trap well, but failed to find Cahill when an accurate pass would surely have seen the deficit halved.
Edison Flores hit the post for Peru as Australia started to look leggy in the draining conditions in Sochi. They couldn't fashion any more chances in the last 10 minutes and it was Peru who climbed to 3rd in the group with a historic win that means so much more than the three points.