Lucas di Grassi claimed an extraordinary first victory of the 2016/17 Formula E season after a chaotic race in Mexico City.
The Abt Audi Sport driver was last after having to pit on the third lap to fix a broken rear wing, but gambled on a safety car just before the halfway mark and claimed the win ahead of Jean-Eric Vergne and Sam Bird.
Poleman Oliver Turvey led the first quarter of the race under increasing pressure from Jose Maria Lopez, but the NextEV driver slowed down on the start-finish straight and crawled to halt exiting Turn 1.
Lopez built a 2.4-second advantage over Nick Heidfeld but the safety car was called so Turvey's car could be retrieved.
At this stage di Grassi was at the rear of the field - he was forced to pit on the third lap to repair the rear wing damage after being rear-ended in the midfieldf at Turn 3 - and decided to pit under the safety car, swapping cars at the end of lap 17 - with 28 still to run.
When racing resumed Lopez slowly rebuilt his advantage as Heidfeld's attentions turned to holding off Vergne, Bird, championship leader Sebastien Buemi and Felix Rosenqvist.
Vergne pit a lap earlier than his rivals but when Lopez stopped a lap later the Argentine remained just in front of the Techeetah driver.
Heidfeld lost out in the stops, as did Buemi, while the Andretti duo of Antonio Felix da Costa and Robin Frijns suddenly (and illegally) joined the lead group after beating the minimum stop by three seconds.
Once the car swaps had shaken out di Grassi led Jerome d'Ambrosio, who had also gambled on an early stop under the safety car, with the gaggle behind half a lap adrift but with considerably more energy available.
Another safety car was called when d'Ambrosio's Faraday Future Dragon Racing team-mate Loic Duval stopped exiting Turn 3, and as the first two watched their lead evaporate it seemed a formality that Lopez would breeze back to the front.
But d'Ambrosio offered an incredibly stern rearguard action and that, coupled with Vergne launching a couple of unsuccessful attacks at Lopez into the Turn 3 chicane, allowed di Grassi to eke out a crucial advantage.
Lopez then lost patience bottled up behind d'Ambrosio and spun attempting a round-the-outside move at Turn 1 - followed almost immediately by Buemi, who made an identical error trying to pass Frijns.
That came just after da Costa suffered a technical problem and stopped, while Frijns was quickly removed from the equation by a drivethrough penalty for his short pitstop.
When the dust settled di Grassi had a multiple second advantage over d'Ambrosio, who continued to frustrate Vergne until a mistake under braking for Turn 1 allowed Vergne to sneak past with three laps to go.
Vergne ran out of time to catch di Grassi, who eked his energy to the end to claim an unlikely but well-deserved victory, while Bird claimed the final podium spot as d'Ambrosio agonisingly ran out of energy on the final lap.
Mitch Evans scored Jaguar's first points with a stunning fourth, having benefited from a bizarre multi-car collision just before Vergne passed d'Ambrosio.
Nico Prost hit Heidfeld at Turn 8 and Rosenqvist ploughed into his spun Mahindra team-mate, while Prost was delayed sufficiently for Evans to nip past.
Lopez benefitted from that madness to recover to sixth, ahead of Daniel Abt - who charged from 18th to seventh after losing pole - the second Jaguar of Adam Carroll, Nelson Piquet and ex-Formula 1 Esteban Gutierrez, who scored a point on his debut.
RESULT - 45 LAPS: