The Minstermen played well on their return to the competition following promotion from the Blue Square Bet Premier and were the better side in Saturday's first half, with Jonathan Smith having a 20-yarder saved in the first minute.
The npower League Two club snatched the lead in the 66th minute with a spectacular goal from Michael Coulson, who hammered into the roof of the net from just outside the box after cutting inside.
But the home side levelled seven minutes later when Chris Brown scored from the penalty spot after Lee Bullock had brought down David Cotterill.
Rovers had the better chances after that, with Rob Jones heading inches wide in the last minute before the game went into extra time. Neither side came close to scoring in the additional 30 minutes, although Kyle Bennett missed a good chance.
Yet it was Rovers who came out on top in the ensuing shootout with goals from Brown, Martin Woods, Bennett and Robbie Blake. Jon Challinor and Michael Potts scored for York but Coulson and Matty Blair blasted wildly over the top.