Sergio Perez, who may be out of work next season, took advantage of his rivals' misfortunes on Sunday to drive from last position to claim his first Formula One victory in a chaotic and crazy Sakhir Grand Prix.
The 30-year-old Mexican recovered from a first-lap crash that dropped him to the back of the field in his 190th race.
Yet he benefitted from a shock Mercedes pit-stop tyre bungle and a late puncture for George Russell, who dazzled as substitute for Lewis Hamilton, to secure his maiden triumph.
Perez became the first Mexican victor in F1 since Pedro Rodriguez in 1970, ending a series of races dominated by Mercedes for whom Valtteri Bottas finished eighth and Russell ninth.
"I'm speechless," said Perez, who wept through most of his victory lap after taking the flag. "I hope I'm not dreaming... Ten years it has taken me and I don't know what to say.
"After that first lap, the race was gone, but I didn't give up. In the end, my pace was good enough to hold off George."
Perez is being released by Racing Point to be replaced by four-time world champion Sebastian Vettel of Ferrari next year, when the team will be rebranded as Aston Martin.
Perez is without a 2021 race seat, but he is in contention to replace Alexander Albon at Red Bull alongside Max Verstappen who crashed out on the opening lap along with Ferrari's Charles Leclerc.
Perez came home ahead of Esteban Ocon of Renault, who claimed his first podium finish, and Lance Stroll, his Racing Point team-mate.
"I have no words," said Ocon. "I cried on the line. That's how much emotion there was inside. It's been a tough season, but we never stopped pushing.
"When there are less and less people believing in you, you have to believe in yourself."
Stroll said: "An amazing result for the team. A part of me is a little disappointed because I could have won, but it's a great result and just what we needed for the championship."
Ferrari-bound Spaniard Carlos Sainz was fourth for McLaren ahead of Daniel Ricciardo in the second Renault and Albon.
Daniil Kvyat was seventh for Alpha Tauri ahead of the two Mercedes 'black arrows', Russell at least claiming his first three points in F1 after leading for most of the race before their pit-stop downfall. He also clocked the fastest lap.
Lando Norris, who started at the back of the grid, finished 10th for McLaren.
Russell made a strong start and was alongside and past Bottas into Turn One in a blur of noise under the dazzling floodlights.
Within seconds, Leclerc and Verstappen crashed out when an aggressive move from the Ferrari driver who collided with Perez. That forced Verstappen in his Red Bull to bounce off the circuit and into the trackside barriers.
Leclerc also careered off the track while Perez spun and continued. He took an early pit-stop as the race was slowed by the safety car conditions and resumed last.
Russell surged clear. By lap 14, he led by more than two seconds, an advantage he retained with impressive maturity for a driver in his first race in a car he barely knew.
The trouble started when Mercedes brought both cars in for the second time and 'double-stacked' them in an ill-prepared and chaotic pit stop.
Russell emerged first, but with a mixed set of tyres and had to pit again, for fresh mediums, while Bottas, in a prolonged stop, was forced to re-fit his hard tyres.
In the confusion, Perez inherited the lead.
Russell swept round the outside of Bottas for fourth, flew down the inside of Stroll for third and passed Ocon to set up a charge on Perez before his dazzling drive was hit by a rear left puncture.
Russell pitted again, for softs, and returned in 14th, but with a post-race stewards' investigation looming.
Perez, in his penultimate outing with Racing Point, raced to the flag.