Jerome d'Ambrosio won a final lap sprint to clinch ABB FIA Formula E victory in Marrakech after long-time leading BMW team-mates Antonio Felix da Costa and Alexander Sims collided.
The Mahindra Racing driver prevailed in the shootout that followed the late-race safety car period to beat Virgin Racing duo Robin Frijns and Sam Bird.
The drama was started by Sims attacking his BMW Andretti team-mate on the outside of the approach to the Turn 7 left-hander at the end of the track's main straight.
Both locked up and then came together on the edge of the corner, with da Costa going straight into the barrier, while Sims ran wide but carried on to run fourth in the safety car queue.
The safety car took the pack around for three laps, with most of the field taking their final attack mode allowance with just four minutes of the race remaining.
Sims was the only driver in the top four to enter the shootout with the higher power available and he attacked Bird as d'Ambrosio's lead was erased by Frijns.
But the Dutch driver could not find a way by despite D'Ambrosio locking up at the final corner and then shooting to the line to win by just 0.143s, with Bird foiling Sims' attacks at the Turn 4/5 chicane and Turn 7 to seal third.
It marked d'Ambrosio's first on-the-road victory in the series, having picked up his previous two wins courtesy of post-race penalties.
He now leads the title standings by 12 points.
At the start, Bird had led away from pole and appeared to have first place sealed on the run into Turn 1, but his fellow front-row starter Jean-Eric Vergne lunged down the inside and the pair touched at the apex.
Bird remained ahead but the contact sent Vergne spinning and the pack had to take urgent action to avoid him, which dropped Sebastien Buemi and Mitch Evans down from third and fourth to 13th and 14th.
There was also contact between Nelson Piquet, Pascal Wehrlein and Lucas di Grassi, while HWA team-mates Stoffel Vandoorne and Gary Paffett also collided - with both retiring a little while later due the damage they sustained.
Bird led the two BMW drivers - Sims taking advantage of the Turn 1 chaos to move up to second - during the early stages, before the duo swapped places and da Costa took up the pursuit of Bird on lap 11 of what would become a 31-lap race.
A leading pack of six formed, with Frijns, d'Ambrosio and di Grassi joining the three leaders, to edge away at the front.
Da Costa stalked Bird before shooting to the inside of the Turn 4/5 chicane - taking the lead after the British driver cut the corner and lost out on the exit, with Sims also getting past his compatriot on the run to Turn 7.
From there, the two BMWs edged clear and Bird fell back and was passed by Frijns, and then d'Ambrosio and di Grassi.
The BMW pair looked to have taken a winning advantage before d'Ambrosio, who had deposed Frijns, led the rest of the top six back up to the leaders shortly before their dramatic collision.
Vergne set scintillating pace for DS Techeetah to recover from the back of the pack after his spin to finish fifth.
At the end of lap one he was 10.7s seconds behind then leader Bird, a gap he closed to four seconds by the time the safety car appeared on lap 26.
Andre Lotterer also carved his way up the order from 21st on the grid to finish behind team-mate Vergne in P6, with the pair of them moving past di Grassi before the race was suspended.
Buemi and Evans recovered to eighth and ninth, with Daniel Abt taking 10th in the second Audi.
Piquet ended up 14th after starting ninth, with Felipe Massa bringing up the rear of the field in 18th.
Wehrlein was the final non-finisher as he retired from his FE debut as a result of the damage he sustained at Turn 1.
|5||Jean-Eric Vergne||DS Techeetah||DS||31||1.232s|
|6||Andre Lotterer||DS Techeetah||DS||31||1.457s|
|7||Lucas di Grassi||Audi||Audi||31||1.633s|
|11||Jose Maria Lopez||Dragon||Penske||31||4.528s|
|14||Nelson Piquet Jr.||Jaguar||Jaguar||31||6.833s|
|-||Antonio Felix da Costa||BMW||BMW||25||Accident|