John Brown's side arrived in Paisley 13 points behind their opponents with five games to play but got the win that kept them up for now.
Jim McAlister had smashed the visitors ahead only for Saints' top scorer Steven Thompson to level just after the interval.
But with time running out, substitute Finnigan squeezed a header down off the underside of the bar and just over the line to ensure that their battle against relegation continued to next week's home fixture with Hearts.
Saints had looked set to push on for a winner themselves before captain Jim Goodwin's dismissal for two bookable offences swung the game away from them.
McAlister made no mistake five minutes from half-time as he put Dundee ahead. Marc McAusland misjudged a high ball and that allowed John Baird to prod into the path of McAlister, who smashed home the bouncing ball from 15 yards.
The visitors' lead was wiped out within seven minutes of the restart, though. Having come close with a couple of corner routines in the first half, Gary Teale came good with his third as he flighted the ball to the back post for Thompson to thunder home his 16th goal of the season.
The home side's task got all the harder as Goodwin collected his second yellow card. The Irishman had clattered into Finnigan down in the left-hand corner just moments after his 59th-minute introduction, earning himself a caution, only to pick up a second with another barge on the striker six minutes later.
The dismissal only spurred on Dundee to go in search of the goal that would maintain their survival hopes for another week. And, just as desperation was about to set in, Harkins squeezed himself to the byline and cut a cross to the back post for Finnigan to smash a header off the underside off the bar and over the line.
Samson claimed he had grasped it before the whole ball had crossed, but referee Craig Thompson awarded the goal after checking with his assistant to send the relieved travelling support into raptures.
- Sports & Recreation
- Steven Thompson
- Jim Goodwin