Sergio Perez secured his first victory for Red Bull after team-mate Max Verstappen suffered a 200mph blowout five laps from the finish of the Azerbaijan Grand Prix.
Verstappen was cruising to his third win of this F1 season, while Red Bull was on course for its first one-two for almost five years when the Dutch driver's left-rear hard tyre on his RB16B sustained a failure.
The accident happened along the main straight, the fastest part of the circuit, and was the second tyre incident after Lance Stroll's Aston Martin also sustained a left-rear blow-out on lap 30 on worn hard tyres.
Like Stroll earlier, Verstappen was sent hurtling into a concrete wall at high speed, and with it went a potential 15-point title lead over Mercedes' Lewis Hamilton, who suffered his own drama.
A decision was taken to red flag the race with three laps remaining, during which time the teams were allowed to change tyres, which served as a natural safety precaution and had been recommended by Red Bull team manager Jonathan Wheatley to FIA race director Michael Masi.
After a 34-minute delay, and with all the cars on soft tyres from a standing restart, a two-lap 'sprint race' unfolded.
On the grid, Hamilton's brakes on his Mercedes could be seen to be smoking, and when the five red lights disappeared he got the jump on 'pole' man Perez.
But on the approach to turn one, his brakes locked up and he went hurtling down the escape road and out of the points for the first time after a run of 54 consecutive top-10 finishes.
Perez went on to claim his second F1 win, and was joined on the podium by Aston Martin's Sebastian Vettel, the team's first since its switch from Racing Point, while AlphaTauri's Pierre Gasly held off original pole man Charles Leclerc in his Ferrari for third.
The upshot means Verstappen still holds a four-point cushion over Hamilton in the drivers' standings.
Leclerc soon swallowed up by Hamilton and Verstappen
It was a remarkable ending following what was a relatively straightforward beginning.
Despite claiming pole position for the second successive race, Leclerc had made clear after qualifying that he did not feel his SF21 had the race pace to match Mercedes and Red Bull, and so it proved.
Following a clean start, apart from a bump of wheels approaching turn one involving Nikita Mazepin in his Haas and Stroll, Hamilton grabbed the lead from Leclerc at the end of lap two, even without the aid of DRS.
Verstappen had to bide his time and it was not until they crossed the line at the start of lap seven that he managed to claim second from Leclerc.
The Dutch driver was then unable to get within a second of Hamilton to use DRS, but two factors soon came into play that allowed him to inherit a position on lap 12 he never relinquished through to the chequered flag.
Hamilton held up by Gasly
The first was that Hamilton's set of soft tyres at the start were three laps older than those on Verstappen's Red Bull, and that forced Mercedes to pull the trigger on a stop after 11 laps.
The second was that Verstappen was given a small helping hand by former team-mate Pierre Gasly in his AlphaTauri as Mercedes had to hold Hamilton in his box for longer than necessary, with a customary 2.5secs stop turning into 4.6s.
In tandem with Verstappen delivering purpling the first two sectors, the undercut was a simple one for Red Bull, notably as the pit crew delivered a tyre-change time of just 1.9s.
The undercut worked a second time with Perez, who had made up two places at the start to move into fourth from sixth before passing Leclerc for third at the start of lap eight.
Although there was a slight delay with his tyre change, he had delivered blistering times in the first two sectors that were enough for him to slot into third ahead of Hamilton and behind second-placed Verstappen and leader Vettel.
For the first time since Brazil 2018, the Aston Martin driver led a race and did so for five laps before eventually pitting, handing the lead to Verstappen.
Behind him, Hamilton managed to keep Perez in his sights but was never within DRS range to use Mercedes' power advantage down the long straight.
Stroll hits the wall hard in Aston Martin
Hamilton had dropped to over two seconds adrift of Perez when after 30 laps Stroll brought out a safety car following a puncture at 200mph along the main straight.
After starting on the hard tyre and as the only driver yet to pit, Stroll was spun round and ploughed nose-first into a concrete wall when the tyre blew.
Mercifully, Stroll was unharmed, but the stationary position of his car around 25 yards from the markings for the start of the pitlane meant Masi had no option but to close it, ensuring no one could take advantage and stop.
After four laps behind the safety car to clear the debris, the pitlane reopened and four of the lower-end-of-the-field drivers - Fernando Alonso, Antonio Giovinazzi, George Russell and Mick Schumacher - switched to soft rubber.
Schumacher, though, was immediately informed to stop his car as the right-front had not been fitted correctly.
At the restart a lap later, the front three of Verstappen, Perez and Hamilton retained their positions, but behind the trio, Vettel slipped up the inside of Leclerc for fifth and then passed Gasly for fourth at the end of the lap.
It then appeared as if the race would reach a straightforward conclusion until the late drama.
Behind the top four, McLaren's Lando Norris was fifth, followed by Fernando Alonso in his Alpine, the second AlphaTauri of Yuki Tsunoda, Carlos Sainz for Ferrari, Daniel Ricciardo in his McLaren, with Alfa Romeo's Kimi Raikkonen claiming the final point for 10th.
With Valtteri Bottas 12th, it is Mercedes' first non-score since the 2016 Spanish GP when Hamilton and then team-mate Nico Rosberg crashed into one another.