Home fans invaded the pitch with just over five minutes remaining, where they proceeded to sit in the centre circle and refused to move, resulting in the players having to leave the pitch.
Brian Smikle tapped home his fourth league goal of the season in the 23rd minute to put the visitors ahead against the run of play.
Stockport defender Mansour Assoumani then had a header from a Tansey corner cleared off the line by Marlon Pack.
On the hour mark, Robins striker Wes Thomas worked some space for himself on the edge of the area before firing an effort narrowly wide of the left-hand post.
In the eighth minute of stoppage time, Andy Gallinagh tripped James Wallace in the area, with Tansey smashing home the resulting spot-kick.