St Mirren squandered a three-goal lead but still progressed to the William Hill Scottish Cup quarter-finals after a dramatic night at Fir Park
Motherwell produced a storming second-half comeback to level the fifth-round replay at 4-4 before extra-time produced no winner.
The match went to penalties and St Mirren emerged victorious 3-2 to set up a quarter-final at home to Kilmarnock or Aberdeen.
A Motherwell defence missing Scotland centre-back Declan Gallagher had shipped four first-half goals as Jon Obika netted twice, Peter Hartley put through his own net and Sam Foley struck.
Allan Campbell briefly had Motherwell level but dozens of home fans headed for the exits before many of those who stayed booed their team off at the half-time whistle.
Those who left prematurely missed a Scottish Cup classic. The fightback began with a classy goal from Tony Watt, who was starting his first Motherwell game in place of the injured Christopher Long.
Fir Park erupted as both Rolando Aarons and Allan Campbell scored from crosses inside 60 seconds and Motherwell, now playing a 3-3-4 formation, pushed for a winner in normal time, but they ran out of steam in extra-time.
Obika opened the scoring in the 14th minute. The striker had plenty of space to cushion home a volley from six yards following an Ilkay Durmus cross.
Mark Gillespie got away with spilling Jamie McGrath’s shot after Alex Jakubiak’s pass had split the home defence before Liam Polworth levelled in the 27th minute.
The midfielder saw his corner come back to him and he drove into a shooting angle and drilled the ball inside the near post.
Saints were back in front four minutes later as Obika exploited some static defending and goalkeeping to stroke home from Cammy MacPherson’s flighted free-kick.
Motherwell were caught with one man back two minutes later as Obika ran at Hartley and saw his blocked shot fall for Foley. The midfielder’s follow-up was stopped by Gillespie and the rebound ricocheted off Hartley and into the net.
Gillespie produced an excellent stop from McGrath but he was beaten in the 43rd minute when Foley fired home after Hartley failed to clear a cross.
Well boss Stephen Robinson immediately took off Gallagher’s replacement, Bevis Mugabi, who had just taken a blow to the face, and Hartley was substituted at half-time.
Watt handed Motherwell a lifeline in the 57th minute as he stabbed home following some penalty-box trickery.
Robinson went for broke five minutes later, bringing on winger Jermaine Hylton for full-back Liam Grimshaw and moving to three at the back.
The gamble reaped dividends. Watt hit the post from close range and Vaclav Hladky saved from Campbell before the hosts stunned the Buddies.
Aarons’ cross evaded everyone and nestled in the far corner in the 73rd minute and Hladky was beaten by another cross inside 60 seconds as Campbell’s delivery took a deflection and looped over the goalkeeper.
Motherwell retained the momentum in a frantic countdown to the 90 minutes. Ross MacIver tried an audacious backheel before Campbell had a shot blocked by some desperate defending.
After the crazy 90 minutes, extra-time proved surprisingly uneventful, perhaps through added caution or tiredness. Motherwell still looked dangerous out wide but St Mirren finished strongly and Obika came close to his hat-trick.
Hladky and Gillespie both saved one penalty each and both Tony Andreu and Watt skied their efforts before Obike netted to put the pressure on Hylton, who missed the target to send Saints through.