The Dons had looked short of confidence following their defeat by Inverness but Mulgrew curled the ball home from 25-yards out to open his account.
Motherwell enjoyed the better of the play but lacked a cutting edge and Jamie Langfield pulled off a great save from Paul Quinn's header.
The late goal was a huge boost for an Aberdeen side that suffered a double fitness blow with midfielder Jamie Smith withdrawing through illness and Zander Diamond limping off 20 minutes into his return from a foot injury.
Motherwell, who handed teenager Jamie Murphy his second first-team start, are left without a point despite starting much the better side.
They dominated the opening quarter without threatening the Aberdeen goal. Their best early move came in the ninth minute when a brilliant flick by Stephen Hughes put the visitors on the backfoot.
Marc Fitzpatrick's through-ball found Murphy in the right channel but his shot across goal was comfortably held by Jamie Langfield.
Aberdeen produced their first attack in the 29th minute when Mark Kerr fed midfield partner Gary McDonald's forward run, but Graeme Smith stood up and parried his near-post strike behind.
Richard Foster, who moved to Diamond's right-back role to allow Duff to play in midfield, was booked for his second bad foul when he tripped David Clarkson as the Well striker broke.
The best chance of the half fell to Murphy five minutes before the break.
Hughes again created space with some good skill before laying the ball wide to the overlapping Steven Hammell.
The left-back's low cross deflected into the path of Murphy, but he was off balance as he shot weakly at Langfield from 10 yards.
Motherwell picked up the pace immediately after the interval and Scott Severin made a crucial tackle when Chris Porter pulled the ball back for David Clarkson inside the box.
The hosts then twice came close from Hammell corners - the first headed just over by Hughes and the second saw Langfield push away Quinn's powerful header.
Mark McGhee brought on Darren Smith for Murphy but Well could not sustain their pressure.
Aberdeen were struggling to keep possession but Kerr found room to drive forward and unleash a shot that Mark Reynolds appeared to stop with an arm just outside the box, although no free-kick was given by Steve Conroy.
Aberdeen brought on Tommy Wright for Lee Miller in the 69th minute and the former Darlington striker came close to a debut goal within 60 seconds.
Fitzpatrick blocked brilliantly as Darren Mackie prepared to shoot and the ball broke for Mulgrew, whose cross found Wright unmarked at the far post.
However, Smith got down quickly to make an impressive stop from the big striker's downward header.
Severin then pushed Clarkson inside the box after the pair collided as the Dons skipper passed the ball back to Langfield with his knee, but Conroy ignored the confrontation.
Kerr and Derek Young were both booked for fouls on Clarkson and Motherwell almost capitalised from the second free-kick but Langfield caught a header on the run from Reynolds.
The game looked to be petering towards a draw but Mulgrew grabbed his first Aberdeen goal in the 86th minute.
The former Wolves full-back took aim after Keith Lasley had fouled Kerr and curled the ball into the corner.
Andrew Considine ensured the three points would go north when his sliding challenge thwarted Smith six yards out after a Porter flick-on landed at the sub's feet.
There was time for Wright to make his mark in Scottish football by moving his head into Stephen Craigan's head as the pair squared up and then being booked for a late challenge on Hammell.