Kevin Nolan struck his eighth goal of the season two minutes into injury-time to end Newcastle's four-match winless run and
preserve their unbeaten home record as Doncaster were beaten 2-1.
The former Bolton midfielder's 18-yard drive went in off the post to cap a stirring comeback from the home side who had initially trailed to Dean Shiels' 18th-minute opener.
Andy Carroll had shrugged off a string of horror misses to bring Newcastle level midway through the second half, while Martin Woods missed a penalty for Doncaster.
The home side also had Zurab Khizanishvili sent off for reacting to a challenge by Billy Sharp in a frantic finish.
The win also means that United caretaker boss Chris Hughton can go into his proposed contract talks with owner Mike Ashley tonight in better heart.
With captain Alan Smith suspended, Newcastle brought Nicky Butt back into their side, while there was also a first league start for Hungarian defender Tamas Kadar as Hughton looked to generate a response to the defeat to Scunthorpe in midweek.
But it was Doncaster, making their first visit to St James' since 1973, who started brighter, with their five-man midfielder crowding Newcastle out and former United junior James Coppinger causing an uncomfortable early moment for their defence with a fizzing cross that forced Steve Harper into action.
Doncaster's composed start was in stark contrast to their hosts and it was fully deserved when they went ahead thanks to a superbly constructed goal.
Coppinger started the move with a ball into the box and, after Woods had superbly flicked Sharp free, the on-loan striker squared for the waiting Shiels who slotted home into an open goal for his second of the season.
With the home crowd instantly angered, Danny Guthrie tried to get Newcastle going with a low drive that Neil Sullivan dealt with, but the atmosphere became increasingly hostile as Hughton's men consistently gave away possession around the Doncaster box.
Marlon Harewood, still to settle since his loan switch from Wolves, did manage to get a header on target, before a fine save from Harper prevented United from going further behind after Woods unleashed a stinging drive from 25 yards.
Newcastle then had two fine chances to equalise in the three minutes before the interval.
The first saw Jonas Gutierrez blaze over with the goal at his mercy after Sullivan had blocked Nolan's header, before Carroll nodded wide as he flung himself onto the end of a Gutierrez cross.
Shortly after the break, Ryan Taylor's dipping corner forced Sullivan to react sharply under his own crossbar, before Carroll conjured up the most unbelievable miss after 53 minutes.
The striker played a neat one-two with Harewood to bare down on Sullivan's goal but, with the veteran stopper having already gone to ground and Carroll six yards out, he somehow managed to fire aimlessly wide of the left-hand post.
A crestfallen Harewood was roundly booed by the home fans as he was replaced by Nile Ranger, but Carroll, who was spared the axe by his manager after his misses, repaid the faith with a stunning equaliser after 67 minutes.
His third goal of the campaign saw him volley home Guthrie's chip pass from the edge of the corner of the six-yard box, flashing his shot across Sullivan and into the far corner.
The hosts were soon to be reprieved, though, as Woods spurned a glorious chance to restore his side's lead.
Referee Darren Deadman had little hesitation in pointing to the spot with 15 minutes to go after a Taylor blocked Sharp's header with his hand, but Woods, with two penalties to his name already this season, planted his effort six feet wide of the left-hand post.
Loan defender Khizanishvili was then dismissed five minutes from time after a coming together with Sharp, which also saw the striker booked.
But undeterred by losing a man, Newcastle ploughed on and got their reward when Nolan picked up Guthrie's pass before firing beyond Sullivan to win it.