Billy Paynter struck a penalty double on his 500th career appearance to extend Hartlepool United's unbeaten run to seven games.
Pools looked like having to share the spoils with a game 10-man Mansfield but when Mal Benning tripped Carl Magnay, referee Graham Salisbury pointed to the spot for the second time.
Paynter drove his 86th-minute penalty past Scott Shearer to give Pools victory.
The skipper had put Pools in front mid-way through the first half after Krystian Pearce brought down Nicky Featherstone and was sent off.
Pools almost made a dream start when James combined with Magnay down the right, the full-back swinging in a cross which Paynter headed over.
But Mansfield had the lion's share of the early stages and should have ended Pools' clean-sheet run in the eighth minute when Matt Green headed millimetres wide of Trevor Carson's right post.
Pools were unlucky not to take a 20th minute lead when Paynter was just off target with a header from a Thomas cross.
But Pools did take the lead ion the 24th minute and it was that-man PAYNTER.
Nicky Featherstone should have scored when put clean through by Paynter, only for the midfielder to be tripped by Krystian Pearce.
The defender was red-carded by referee Graham Salisbury and while keeper Scott Shearer guessed right by diving to his right, he could not keep out the spot-kick.
Thomas celebrated too wildly and after some pushing and shoving between several players was booked by Mr Salisbury.
The winger though was in great form on the left and after a cross came into the box, Paynter turned smartly only to see his shot hit the goalie's left stick.
Mansfield could not be discounted after drawing 2-2 with Northampton with 10 men and Lee Collins shot over the home bar.
Pools looked unusually flat in the early part of the second half with the Stags having most of the play.
Featherstone did see a 20-yard shot deflected for a corner which Gray put over and Magnay got his head to, but Shearer collected with ease.
An away goal was looking likely given the possession the Stags were enjoying.
It needed great saves by Carson low to his right and then left in the space of three minutes kept Mansfield out.
Hignett brought on Rob Jones after 69 minutes for Thomas, with Pools going 3-5-2.
Despite the change, Town were still on top and Carson saved a Chapman free-kick on 74 minutes.
Mansfield pulled level in the 76th minute and deservedly so.
Carson saved again from Green but DANIEL hammered the rebound high into net.
But the drama continued when Pools re-took the lead in the 85th minute thanks to another PAYNTER penalty.
Sub Woods did superbly to keep the ball in, allowing Magnay to attack, with the full-back tripped on the edge of the box by Benning.
Paynter stepped up and drove the spot-kick powerfully past Shearer.
Pools, with Woods in imperious form, played out time to extend the unbeaten run to seven games.
Pools: Carson, Magnay, Bates, Jackson, Carroll, Featherstone, Gray (Woods 81), Hawkins, Thomas (Jones 69), Paynter, James (Bingham 83)
Subs: Bartlett, Richards, R Jones, Bingham, Oates, Woods, Walker
Goals: Paynter Pen 24, Pen 85
Booked: Thomas 24
Mansfield: Shearer, Collins, Pearce, Tafazolli, Benning, Chapmam, Thomas, Blair, Clements (Daniel 38), Green, Dieseruvwe (Alfei 29, Beardsley 86)
Subs: Jensen, Rose, Beardsley, Daniel, Lambe, Alfei, Baxendale
Goal: Daniel 76
Sent-off: Pearce 23
Booked: Blair 54, Benning 84
Referee: Graham Salisbury