(CNN) -- BMW Sauber's Robert Kubica claimed his first victory in Formula One and moved to the top of the drivers' championship after a disastrous error by previous leader Lewis Hamilton at the Canadian Grand Prix on Sunday.
Robert Kubica led home a BMW Sauber 1-2 in an incident-filled Canadian Grand Prix.
Hamilton's McLaren rammed into the back of world champion Kimi Raikkonen's Ferrari as the Finn and Kubica were waiting at a red light after the safety car was forced into action on lap 17.
The British driver claimed his maiden victory at the Montreal venue last year and was seemingly set for a second successive win after his triumph in Monaco, but his error in judgment ended his race and that of Raikkonen.
It allowed Poland's Kubica the chance to later overtake teammate Nick Heidfeld, who took the lead after the incident, and dominate for the rest of the 70-lap event.
It represented a remarkable turnaround for the 23-year-old driver, who survived a horrific crash in the race last year.
He finished ahead 16.4 seconds ahead of Heidfeld to notch in his first triumph in 29 starts to go four points ahead of Hamilton in the drivers' standings.
German driver Heidfeld, also seeking his first F1 victory, finished in second place ahead of Red Bull veteran David Coulthard, while Toyota's Timo Glock held off Ferrari's Felipe Massa to claim fourth.
Brazilian Massa moved level with Hamilton on 38 points, three ahead of the unlucky Raikkonen -- who finished without a point for the second successive race.
Ferrari retained top spot in the manufacturers' standings, but second-placed BMW Sauber closed the gap to just three points. McLaren dropped to third, a further 17 points back, after Heikki Kovalainen finished ninth.
The safety car had been called onto the circuit after Force India driver Adrian Sutil was forced off the track due to mechanical problems.
Hamilton, who started from pole position ahead of Kubica, had been almost seven seconds ahead of the Pole at that stage after an incident-free opening to the race.
But the pit-lane crash allowed Coulthard, Rubens Barrichello, Jarno Trulli and Glock to have turns out in front before Kubica established himself.
The safety car was called out a second time when Sutil's teammate Giancarlo Fisichella hit a wall, but Kubica kept his cool and retained his lead.
"It is fantastic to win for BMW Sauber," Kubica told reporters. "We grew up together and thanks to the team for providing a good car -- we managed to do first and second.
"Winning in Canada where I had big shunt last season and achieving the goal to win a grand prix this season ... we have done it and I'm leading the championship, so I hope the team will give me 100 percent support to defend it until last race.
"It's fantastic for me, the team, my country and my fans. It was a great race. It is always chaotic here with the safety car and it is not easy. I have never struggled so much before, I was pushing so hard."
Hamilton said he was unaware that Raikkonen and Kubica had stopped at the top of the pit lane.
"I don't know what happened to be honest," Hamilton said. "I was comfortably in the lead, it was looking like an easy win. Then I went in for the pit stop. It was not a good stop and I saw the two guys in front of me battling in the pit lane.
"I saw the red light but by that time it was a bit late. It was not exactly a racing incident as such, it was unfortunate. It was one of those things. It is different to if you crash into the wall and you are angry. It is not like that. I apologize to Kimi for ruining his race."
After the race, Hamilton was given a 10-place grid penalty for the French Grand Prix at Magny-Cours in a fortnight. Nico Rosberg of Williams was given the same punishment after he ran into the back of Hamilton's car in the same incident.
Two-time former world champion Fernando Alonso was fast closing on Heidfeld and Coulthard when his Renault spun off the track and hit a wall on lap 45 as the Spaniard's miserable season continued.
The much-maligned surface at the Circuit Gilles Villeneuve held up surprisingly well, despite fears that the track would break up as it had done last year and during Friday and Saturday's sessions.