Well defender Stephen McManus headed in from the corner after 47 minutes before striker Adam Rooney, making his Dons debut, levelled in the 65th minute, also with a header.
The visitors looked more likely to go ahead and win the game but two minutes later a combination of John Sutton and Zaine Francis-Angol forced the ball over the line from a Henri Anier cross, both men claiming the goal.
However, the Dons came back again and got the point they deserved in the third minute of five added at the end of the game when, amid a packed six-yard box, Anderson bundled the ball in although it appeared to have gone in off his arm.
Referee Steven McLean had Shaun Hutchinson and the rest of the Well players in uproar when he produced a yellow card in the eighth minute for the tackle on Ryan Jack - their evidence for innocence was that he had taken the ball - but the Dons defender was clearly in some pain as he was taken off, to be replaced by Peter Pawlett.
From the resulting free-kick 20 yards from goal, Aberdeen midfielder Barry Robson fired just over the bar.
In the 16th minute Francis-Angol's cross from the left was met by James McFadden at the near post but his flick was well-saved by Dons keeper Jamie Langfield.
The Dons came close in the 32nd minute when midfielder Barry Robson robbed the dithering Stuart Carswell 40 yards from goal and strode forward before unleashing a low drive which beat Well keeper Gunnar Nielsen only to hit the post before flying wide.
Moments later, at the other end, a great tackle from Anderson thwarted Sutton.
Both teams continued to go hard at it in their bid to get the breakthrough with Jonny Hayes drawing a fine save from Nielsen just before the interval with a powerful angled-drive.
The crowd were still settling in at the start of the second-half when McManus gave the home side the lead.
The former Celtic defender rose to meet a Lionel Ainsworth corner with his head and Pawlett, standing on the line, could only help the ball into the net.
Motherwell defender Fraser Kerr was then taken off on a stretcher in the 55th minute after a challenge with Robson, to be replaced by Paul Lawson and after that the visitors stepped up their pressure.
Dons defender Shaughnessy missed a couple of attempts, both from Hayes crosses and Niall McGinn had a shot blocked but the leveller came when the Northern Ireland international had a shot parried by Nielsen.
Rooney found himself on his own to head in from eight yards before taking the acclaim of the travelling fans behind the goal.
Their joy was short-lived as Anier made an immediate impact after replacing James McFadden by crossing for Sutton to scramble the ball over the line from a yard out although Francis-Angol also looked to take the credit.
Back came the Pittodrie side and Rooney missed a great chance from close range, spooning the ball over the bar.
Aberdeen kept pressing for the leveller and it came in the final moments when, from a McGinn corner, Anderson knocked it in from close range to keep the Dons in second-place in the table.