In a game which could have gone to either side or to extra time and beyond, the Bulls slipped through to the Second Qualifying Round courtesy of a last-gasp winner.
AFC controlled the first half before the visitors from a tier below began to grow into the game after the break, but top-scorer Ross Duggan was in the right place at the right time to steal the place in the next round at the very death.
Three minutes passed before the first real chance came for the Bulls, when Prims 'keeper Brown fumbled Jack Warwick's low effort before Duggan poked narrowly wide.
Duggan came even closer to an opener 10 minutes later, lobbing Brown from 40 yards out only to hit the post.
After 20 minutes it was the Prims' turn to create an opportunity with Lewis Tooley crossing in dangerously, but Hugo Warhurst came out to claim well.
Chances continued to come and go, with debutant Jack Hague volleying towards goal in a scramble to see it deflect wide for a corner.
Warhurst had to make his first real save of the game ten minutes from half-time, getting down to deny Lee Fell at his near post.
The frustrations of the first period were summed up perfectly at the very end, when full-back Jordan Annable opted to cross inside the penalty area before Duggan came agonisingly close to tapping home at the far post.
Kevin Morrow had the ball in the net at the other end just before the half-time whistle, but the Bulls were saved by a blow for a foul by referee Lee Bramley.
Just a few minutes into the second period Warhurst was called to make one of the most important stops of the game, denying Morrow in the style of Gordon Banks by superbly palming the striker's header away at his bottom corner from close range.
It began to turn into a game of two goalkeepers not long after, with Brown stepping up to the mark to parry Duggan's volley heading for the top corner.
Brown earned the applause of the whole Forest Town Arena on 77 minutes, denying substitute Luke Walker's stinging effort before tipping Phil Buxton's wide for a corner.
It looked like the tie was heading for a replay after Walker skied a crucial chance inside the penalty area at the end of normal time, but top-scorer Ross Duggan came to the Bulls' rescue in the dying moments as he received Buxton's corner before slotting home deep into stoppage time.
The dramatic win means the Bulls will potentially face local rivals Rainworth Miners Welfare in the Second Qualifying Round if they won their fixture.
Final score | AFC Mansfield 1-0 Graham Street Prims
Scorers | Duggan (90'+3)
AFC Mansfield XI | Warhurst (GK), Annable, Williams, McGuire, Hague (Hague 87'), Hough, McMillan (Wright 61'), Buxton (C), Duggan, Warwick (Walker 61'), Webster
Unused substitutes | Corder, Darker
Yellow cards | N/A
Red cards | N/A
Graham Street Prims XI | Brown (GK), Hunt, Turner, Thurman, Dawson, Ball (C), Tooley, Fell, Morrow, Fitzhugh (Gwinutt 88'), Lynam (Bryne 68')
Unused substitutes | Scard, Grimshaw, Wright
Yellow cards | Ball (75')
Red cards | N/A
Man-of-the-Match | Richard Williams
Attendance | TBC