Dundee's four-month winless streak in the Scottish Premier League came to an end as they came from behind to sink St Mirren 2-1 at Dens Park.
John Brown's side cut the huge gap on the second-bottom Buddies as second-half goals by John Baird and Jim McAlister cancelled out Dougie Imrie's 18th-minute opener.
Dundee have nine games remaining to overhaul the 14-point gap to the Saints and pull off the unlikeliest of escape acts, but this result will at least give their battered confidence a lift for the run-in.
Despite beginning the match well adrift at the foot of the table, there was never going to be any talk of throwing in the towel from those inside the home dressing-room.
Dundee's first chance came after 10 minutes when Baird set Gary Irvine free into the box but he blazed wide of the target.
Despite that bright opening it was the visitors who went ahead inside 20 minutes.
Conor Newton dinked the ball forward to Lewis Guy who turned it back into the path of Imrie, who took a touch before rifling a rasping right-foot effort into the far corner.
Saints were slick going forward had a chance to increase their lead after 35 minutes, this time Guy turning Davide Grassi inside out down the right before cutting inside and seeing a powerful right-footed shot superbly saved by Rab Douglas at full stretch.
Douglas was again called into action five minutes before the interval as the visitors stepped up the pressure.
Graham Carey burst down the left to deliver a pin-point cross for Parkin, whose header looked destined for the bottom corner until Douglas somehow managed to claw it away for a corner.
Dundee were in desperate need of some inspiration after the break so Brown wasted no time introducing Ryan Conroy and Nicky Riley in the hope they could conjure up something in front of an increasingly frustrated home support.
And after 67 minutes the Dundee faithful got their reward as the hosts levelled through Baird, who picked up the ball 20 yards from goal and picked his spot in the corner with a low 20-yard drive.
With their tails up, the home side pushed for a winner and it duly arrived in the 77th minute with McAlister the hero.
Gary Harkins' cross was laid back at the far post by Riley and McAlister kept his composure to finish from six yards and secure Dundee's fourth league win of the season and first since November 17.