York City appeared to be on their way to a second successive home defeat until midfielder Stephen Brackstone equalised in stoppage time with a sublime free kick.
While Rovers were organising their defensive wall, Brackstone showed quick thinking in chipping the ball over the wall and into the top right-hand corner of the net.
City dominated the opening half with loan winger Lee Cook a constant threat as he used his pace to run at the Rovers defence.
In the ninth minute he ghosted past two defenders by the corner flag but his inviting low cross lacked the finishing touch.
Brackstone twice delivered telling crosses from the right with Peter Duffield desperately unlucky with a flying header at the far post.
Rovers lost defenders Trevor Challis and Kevin Austin through injury within five minutes of each other but reshuffled and coped well until conceding a penalty in the 38th minute.
Latvian international Vitalijs Astafjevs handled Jon Parkin's pass and Duffield fired home his seventh goal of the season from the spot.
However, Rovers hit back in fine style and in the 40th minute defender Anwar Uddin received David Lee's free kick with his back to goal, but had time to turn and see his shot creep past the City defenders and keeper Alan Fettis for the equaliser.
Two minutes later the visitors went in front when Astafjevs picked up the ball 25 yards out on the right and hit a superb dipping cross shot into the far corner of the net.
Before the break City still had chances to equalise through Duffield and Graham Potter.
Rovers boss Ray Graydon organised his troops well in the second half as they defended stoutly and limited City to only a handful of half chances.
The best of these fell to Parkin who contrived to scoop Cook's cross on to the bar from only six yards out.
Pirates keeper Ryan Clarke then dropped Nicolas Mazzina's cross under pressure from Parkin and Duffield's header was cleared off the line by Simon Bryant.
As time was running out, with City wasting possession too frequently, youngster Brackstone's quick thinking and quality finish at the death earned City a point