Dundee remain bottom of the cinch Premiership after Connor Ronan's stoppage-time header helped St Mirren to their first victory under new manager Stephen Robinson.
The match looked set to be heading for a stalemate when the Wolves loanee fastened on to Jay Henderson's cross to earn his side a 1-0 win.
St Mirren stayed ninth, only a point behind fourth-placed Hibernian, while Dundee remained one point adrift of second-bottom St Johnstone.
- How the teams lined up | Match stats
- Scottish Premiership table | Fixtures | Results
- Scottish Premiership: Title race, top-six battle & who goes down?
- Get Sky Sports
Dundee manager Mark McGhee missed the match after testing positive for Covid-19, with his assistant Simon Rusk taking the team in his absence.
The Dark Blues made three changes from the side that had drawn with Motherwell. In came Niall McGinn, Luke McCowan and Zeno Ibsen Rossi, replacing Vontae Daley-Campbell, Shaun Byrne and Lee Ashcroft, the latter becoming ill in the warm-up.
St Mirren made two alterations following their defeat to Ross County at the weekend. Alex Greive and Conor McCarthy both dropped to the bench with Ronan and Eamonn Brophy starting in their place.
Opportunities were few and far between and from another Dundee corner Jordan McGhee volleyed over from McGinn's delivery.
Cammy Kerr then had the game's first shot on target that was easily fielded by Dean Lyness before St Mirren finally threatened through Jordan Jones whose attempted chip was caught by Harrison Sharp.
Greg Kiltie then did well to pick out Brophy but the striker's shot was blocked by Rossi on the line. McGhee then tried his luck from distance at the other end but his shot sailed well over the crossbar.
Dundee started the second half on top and Ronan almost put the ball into his own net as he stretched to clear Rossi's knock down from a McGinn free-kick.
Jones then passed up a glaring chance to put the visitors in front, lashing his volley over an open goal after Brophy had been denied twice in quick succession.
Saints appealed for a penalty after Scott Tanser's cross appeared to strike Ryan Sweeney's arm but referee John Beaton waved play on.
Brophy had another chance from a Jones centre but headed wide before Sweeney almost deflected a cross into his own net.
St Mirren had the ball in the net in the 90th minute but Richard Tait's header was ruled out for an infringement.
Their disappointment was short-lived, however, when Ronan struck almost three minutes into stoppage time.
Rusk: Painful to concede so late
Dundee assistant manager Simon Rusk:
"Conceding that late is a painful one for everyone and it was preventable as well. I don't think we can have too much of a complaint about the result on the balance of the second half.
"The first half was even but they had more momentum in the second half and we struggled to turn it back the other way.
"We have to assess it and understand it in more depth. The fact is we were not at the level we needed to be in the second half. We have to stick together and work hard as a group."
Robinson believes St Mirren are 'right in the mix for the top six'
St Mirren manager Stephen Robinson:
"We're right in the mix for the top six again.
"I thought we were excellent throughout the second half. It was a great cross from young Hendo (Jay Henderson) and a brilliant header from Connor Ronan.
"Overall I thought we deserved it. We had six clear-cut chances inside the box and didn't take any of them and you start to think it's going to be one of those nights.
"But it wasn't and that shows the character of the squad. It would have been cruel if we hadn't taken all three points.
"The biggest pleasing thing for me was not just the style we played but the patience we had, we didn't just try to launch it up the pitch.
"The league is very tight, it's small and fine margins.
"If we don't win tonight then there's a wee bit of pressure comes with it and it probably hurts our chances of top six.
"St Mirren haven't been in the top six for a long time but now we have given ourselves hope of being in there.
"We have Motherwell, Dundee United and Rangers before the split. It's certainly an opportunity and now it is up to us to take it."
What's next?
Dundee host Rangers in the Scottish Cup quarter-final on Sunday; kick-off 4pm. St Mirren travel to Hearts in the last eight on Saturday; kick-off 7.45pm.