St Mirren threw away a three-goal half-time lead before roaring back to beat Motherwell on penalties and clinch a Scottish Cup quarter-final place.
Jon Obika’s spot-kick ultimately won the shootout after an epic encounter and earned Jim Goodwin’s side a home tie against Kilmarnock or Aberdeen.
Obika’s brace either side of Liam Polworth’s leveller, an own goal, and Sam Foley’s strike had St Mirren in control. But Tony Watt and Rolando Aarons reignited the tie, before Allan Campbell’s cross deflected in to level.
Neither side could find a winner in the final 16 minutes of the 90 – or in extra time – and only one of the first five penalties was converted.
But after Obika rolled in St Mirren’s fifth attempt from the spot to make it 3-2, Jermaine Hylton missed for Motherwell to put the visitors through.
It means the Paisley side will now host the winner of Wednesday’s replay in the quarter-final on February 29 at 19:20 GMT live on BBC Scotland.
After Storm Dennis got the better of the league meeting between these sides at the weekend, the Fir Park pitch was passed fit for this fifth-round replay, despite the odd heavy shower before kick-off. But the tumult caused by the weather was nothing compared to what unfolded in an astonishing encounter.
It took St Mirren 14 minutes to cleave open an advantage, when Ilkay Durmus’ delightful, inch-perfect delivery fell for Obika to record his ninth goal of the season.
Jamie McGrath stung the palms of Motherwell goalkeeper Mark Gillespie, but it was the hosts who would score next as St Mirren failed to deal with a corner, and Polworth’s low drive deceived St Mirren keeper Vaclav Hladky.
That was just before the half hour, but the next 13 minutes featured a stunning spell by the visitors, in particular Obika and Watford loanee Alex Jakubiak.
Obika got the better of the Motherwell defence before guiding his second past Gillespie, then turned provider for Foley to lash a shot at the goalkeeper. That effort was saved, but the ball bounced back off defender Peter Hartley and diverted into his own goal.
The home fans were not impressed, as boos rang out around Fir Park, but it would get worse before it got better. A truly stunning one-handed save by Gillespie kept out Cammy MacPherson’s shot before Obika again rampaged forward and set up Foley, who this time found the net.
Motherwell, already weakened by illness and injury to Declan Gallagher and Christopher Long, changed their shape for the second half as they tried to claw their way back into this tie.
It had the desired effect as Watt – on his first start – raced into the area and shaped an effort beyond Hladky with the help of a slight deflection.
It was the former Celtic, Hearts and St Johnstone forward’s first goal for Motherwell and team-mate Aarons achieved the same feat 16 minutes later when his cross-cum-shot caught out Hladky.
That made it 4-3 and, suddenly, a hitherto dominant St Mirren were rocking violently as Fir Park came to life. Within 60 seconds, it got even louder as Campbell’s cross took a nick off Foley and looped over a bewildered Hladky.
In the final 16 minutes, it was end-to-end stuff, with both sides creating chances to win this remarkable tie. Despite their efforts, the game went into extra time, which was understandably played at a less frantic pace as tiredness and nerves sapped the energy.
It was St Mirren who perhaps had the best chance to seal the tie – Obika’s effort floating over the bar – as Motherwell finished with 10 men thanks to an injury to Jake Carroll.
It went to penalties and yet more drama, with five players missing their attempts. St Mirren’s Jamie McGrath was the only man to score among the first five takers, with team-mates Tony Andreu and Cammy MacPherson joining Motherwell’s Liam Donnelly and Watt in missing.
Aarons and Kyle McAllister traded penalties before Obika’s conversation heaped the pressure on Hylton, whose attempt failed to find the net, to put St Mirren into the last eight.