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 Republic of Ireland Under-21 international 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.
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.