Kevin Nolan's injury-time winner gave Newcastle a dramatic victory and took them to the top of the Championship.
Doncaster went ahead when Martin Woods slotted into an empty net after being set up by on-loan forward Billy Sharp.
Andy Carroll volleyed home an equaliser before Woods fired a penalty wide after Steven Taylor's handball.
Newcastle were reduced to 10 men when Zurab Khizanishvili was sent off, but Nolan secured the points with an 18-yard drive that went in off the post.
The home fans had earlier made their frustration clear as their team consistently gave the ball away while Doncaster caused them problems.
Striker Marlon Harewood, on loan at Newcastle from Aston Villa, produced a disappointing performance and was booed by the St James' Park crowd when he was substituted just before the hour mark.
And Carroll squandered a number of good chances before finding the net.
His worst miss came when he combined with Harewood and then rounded keeper Neil Sullivan, only to shoot wide.
Carroll's leveller galvanised the Magpies and they continued to press after the 84th-minute loss of Khizanishvili, who was dismissed for reacting angrily to a challenge from Sharp.
They were rewarded when Nolan collected Danny Guthrie's pass and
fired beyond Sullivan.
Newcastle caretaker manager Chris Hughton:
"I'm certainly relieved that it (the penalty) didn't go in.
"In the first half they (Doncaster) played a good tactical game but they will keep possession against any team.
"I thought over the 90 minutes that if there was a side that was going to win the game I felt it was us but at 1-1 and with the penalty you think the worst."
Doncaster manager Sean O'Driscoll:
"Penalties will be scored and missed as long as there are football matches.
"There's no point hiding behind that, we pride ourselves on doing certain things and at times I thought we didn't do them very well.
"All we ask is that if they make a mistake they react in a positive manner."