The Stags looked like they were going to make it five wins on the bounce after substitute Jake Speight's 75th-minute goal but, in the fifth minute of injury time at the end of the game, Martin Riley fouled James Gray inside the area and Stanley sub Naismith held his nerve to secure a precious point for his side in their battle against relegation.
It was a close game which could have gone either way as the visitors looked to mount a late challenge for the play-offs.
In the first half, goalkeeper Lewis Price kept out Stanley striker Shay McCartan's drive with his legs and also tipped over a Peter Murphy effort on the stroke of half-time.
Accrington keeper Marcus Bettinelli also had to be in top form, turning Oliver Palmer's effort round the post and palming away Matt Rhead's fierce strike.
After the break, Ryan Tafazolli should have done better with a thumping header for Mansfield but could not find the target while Sam Clucas could only find the side netting.
Speight then made his effort count when he fired into the roof of the net from eight yards out after fellow sub Clucas had beaten two players on the right wing before playing in an accurate cross.
Mansfield almost had a second goal when Bettinelli's kick rebounded off Speight and hit the post in injury time.
But Stanley went straight down the other end and referee Richard Clark pointed to the penalty spot for Naismith to secure a point.