The Paisley club, who have the worst away record in the Premiership, blew a three-goal first-half lead but came out on top in the penalty shoot-out which followed 120 minutes of non-stop action.
Jamie McGrath, Kyle McAllister and Jon Obika displayed nerves of steel to convert their attempts, with Tony Andreu and Cammy MacPherson missing. For Motherwell, Rolando Aarons and Liam Polworth succeeded but Liam Donnelly, Tony Watt and Jermaine Hylton failed to score, ending a rollercoaster of a ride for their fans on a disappointing note.
Motherwell are now without a win in six matches and their players will need some lifting after this defeat, particularly when they appeared to have the momentum on their side following a thrilling second-half display.
St Mirren haven’t had much joy on the road this season but they broke the deadlock here with a goal of genuine quality. Ilkay Durmus claimed the assist with a swerving cross between the goalkeeper and his defenders which neither was able to decide whether to stick or twist and Obika raced between them to volley home from six yards.
Motherwell responded well initially to that setback, Polworth beating the unconvincing Vaclav Hladky at his right-hand post from 18 yards after his corner kick had been sliced back to him.
The fightback was brief, however, as two goals inside a minute by the visitors put them in control. Jake Carroll received the first yellow card for a cynical foul on Obika but more severe punishment was immediately forthcoming when MacPherson’s floated free-kick found the striker unmarked and he fired home his tenth goal of the campaign.
Motherwell manager Stephen Robinson was incensed by his team’s defending and worse was to follow when Saints regained possession from Motherwell’s kick-off. Obika once again surged forward, his shot deflected by club captain Peter Hartley into the path of Sam Foley. The Irishman’s drive was pushed out by goalkeeper Mark Gillespie but struck the inrushing Hartley and trickled into the net.
Before the break more dilatory defending led to the visitors stretching their lead. Durmus’ cross ought to have been cleared but it fell benignly for Foley and his low drive from 15 yards left Gillespie helpless, although he did well to keep out a snapshot from Jamie McGrath before the half-time cuppas were poured.
That save proved a pivotal moment as Motherwell were transformed in the second half. Inspired by substitute Mark O’Hara, they came out of the traps like Usain Bolt and dominated the second period.
Former Celtic striker Watt began the revival with an individual goal 12 minutes in, twisting and turning past two opponents before seeing his shot deflected away from Hladky.
The fightback was on, although it required two large dollops of good fortune before they were level again. Hladky will not want to watch a replay of the cross-shot by Aarons which left him flat-footed as it looped over him and into the net and he was caught clutching thin air again when Allan Campbell’s delivery ricocheted off Calum Waters and over the keeper for the equaliser which brought the additional 30 minutes.