Red Bull's Daniel Ricciardo passed Nico Rosberg's crippled Mercedes with two laps to go to win a thrilling Canadian Grand Prix.
Rosberg held on to take second ahead of Red Bull's Sebastian Vettel, helped by a last-lap safety car following a crash between Sergio Perez and Felipe Massa.
Rosberg's team-mate Lewis Hamilton retired with a brake failure and is now 22 points behind in the championship.
McLaren's Jenson Button stunningly took fourth with late charge.
The Englishman passed Force India's Nico Hulkenberg and Ferrari's Fernando Alonso on the penultimate lap.
It was a sensational end to a race that was full of incident and tension, as Mercedes' early season domination of Formula 1 came to an end in the most remarkable of circumstances.
The first part of the race ran to form, with Rosberg narrowly ahead of Hamilton as the two Mercedes drove off into a race of their own.
Rosberg held on through the first pit stops but was quickly closed down by Hamilton thereafter.
But just as the Englishman appeared to be setting up to pass his team-mate for the lead both cars suffered a simultaneous loss of power from the engine.
Hamilton took the lead during the second pit-stop period after Rosberg was delayed by a problem fitting a front wheel at his stop.
But on the very next lap Hamilton ran wide at the hairpin, a symptom of the total brake failure he was about to experience at the next corner.
That put Rosberg back into the lead and although Perez closed up, closely tracked by the Red Bulls, he was unable to pass, as he too was managing fading brakes.
But with Rosberg just managing to hold off Perez and the Red Bulls, Ricciardo began to apply pressure to the Mexican, and passed him around the outside into Turn One with four laps to go.
The Australian, who joined Red Bull at the start of this season and has generally had the measure of his four-time world champion team-mate, quickly closed on Rosberg and passed him down the long final straight on lap 68 of 70.
Red Bull team principal Christian Horner said: "Amazing, the boy's driven brilliantly all year. The move of the race was around the outside of Perez a few laps from the end."
The race came to an abrupt end at the start of the final lap when Massa misjudged an attempt to pass Perez and his Williams crashed into the Mexican's Force India as they braked for the first corner.
The two cars narrowly missed hitting Vettel's Red Bull as they spun into heavy impacts with the tyre wall.
In the excitement, it was not immediately clear how Button, who was eighth with six laps to go, passed both Hulkenberg and Alonso for fourth.
Williams' Valtteri Bottas took seventh, ahead of the Toro Rosso of Jean-Eric Vergne, Kevin Magnussen's McLaren and Ferrari's Kimi Raikkonen.