Kieran Sadlier returned to his former club to score the goal that pushed Doncaster nearer the drop and kept Wanderers looking upwards.
Sadlier enjoyed a successful 18 months at Doncaster and will have taken no pleasure in keeping Rovers stuck in the bottom two and with time running out on their survival chances.
But his superbly-taken strike – a minute after Doncaster had equalised – capped another lively performance from the wideman who continued the impressive start to his Wanderers’ career with a second goal in three games to extend the Whites’ unbeaten run to five games in their quest to finish with a flourish.
Amadou Bakayoko’s 12th goal of the season two minutes into the second half hinted at an easier afternoon for Ian Evatt’s men.
But Doncaster’s desire to prolong their League One life made it a highly competitive contest which was level when substitute Mipo Odubeko equalised with almost his first touch.
With less than a quarter of an hour to go, Wanderers might have settled for a fourth successive 1-1 draw.
But again they showed their desire to keep going until the end and another late goal – clinically volleyed home by Sadlier – clinched a ninth away win to keep the top ten in sight ahead of Monday’s visit of Accrington Stanley.
Wanderers gave a first start since January to George Thomason and brought Bakayoko back into the line-up after his recent goal-scoring impact from the bench as Evatt freshened things up in the first of two games in four days.
And Bakayoko went close to giving the Whites an early lead with a powerful header he put over the top after Declan John had nodded an Aaron Morley cross back across goal.
Doncaster – desperate for a win to keep alive their slim survival hopes – survived an early examination to have a decent spell of their own as Josh Martin twice forced James Trafford into action and skipper Tommy Rowe bounced an effort onto the top of crossbar.
Matt Smith also dragged an effort wide from a decent position after Reo Griffiths had laid off a cross from Kyle Knoyle.
But there was no suggestion Wanderers were happy to just coast towards the finish with three players – Williams, Thomason, Bakayoko – going into the book as they battled to gain the initiative.
And the Whites had further chances of their own to lead at the break with Jon Dadi Bodvarsson almost forcing the ball past keeper Jonathan Mitchell before doing well on the break to release Bakayoko for an opportunity his strike partner curled just wide.
The pair had linked well and three minutes into the second half the combination provided the opening goal.
Bodvarsson again won the ball and led the charge and when he crossed low from the left, Bakayoko arrived right on cue to coolly steer home his seventh goal in his last 15 appearances.
The goal did nothing for Rovers’ chances of beating the drop, although they were almost handed a route back into the game as Trafford suddenly took centre-stage.
The keeper’s poor clearance allowed Smith to tee up Aidan Barlow, only for Trafford to make amends with a fantastic save low to his right to deny the Rovers’ forward an equaliser.
Will Aimson then made a superb challenge to thwart Reo Griffiths and Wanderers – without the cushion of a second goal – were suddenly under pressure and needed Trafford again to keep out a free-kick from Martin with another fine reflex stop which did just enough to deflect the ball wide of the target.
The teenager then blocked a Rowe effort at his near post but with 13 minutes to go Rovers forced the breakthrough to make it 1-1 when Rowe headed the ball back for Odubeko to crash a shot into the roof of the net.
But instead of Doncaster looking to make it back-to-back wins for the first time season, Wanderers produced the perfect response to go back in front within 60 seconds to secure their first victory in four attempts.
Substitute Dapo Afolayan floated a delightful cross-field ball beyond the far post where Sadlier connected with a perfectly-executed side-footed volley to pick out the top corner with a strike worthy of winning any game.
Wanderers: Trafford; Jones, Aimson, Johnston; Williams; Sadlier, Morley, Thomason (Afolayan 74), John; Bodvarsson (Kachunga 74), Bakayoko (Charles 66). Substitutes: Dixon, Amaechi, Baptiste, Gordon.
Booked: Williams, Thomason, Bakayoko, Johnston
Doncaster Rovers: Mitchell; Knoyle, Williams, Olowu, Rowe; Bostock (Odubeko 74), Clayton; Barlow (Galbraith, 55), Smith (Dodoo 88), Martin; Griffiths. Substitutes: Jones, Younger, Jackson, Gardner.
Booked: Galbraith, Williams
Referee: James Oldham
Attendance: 8,668 (Wanderers 2,698)