When Rafa Ramos put Gosport 3-0 up within two minutes of the second half, it appeared to be game over.
The in-form home side were seemingly cruising into the third round of the Hampshire Cup at Privett Park.
But a Pompey team comprised solely of academy players put up a fight and amazingly managed to level.
Connor May’s finish was sandwiched by a Koby Mottoh brace, with his second goal coming from the spot in stoppage-time.
And the wing-back then converted the winning penalty in the shoot-out, with the comeback hailed by Sam Hudson.
Pompey’s lead professional development phase coach said: “It was a tie that had absolutely everything – a comeback, a sending off, penalties.
“There were moments we looked really strong and others when we were a bit naïve and showed our age.
"There wouldn’t be many people in the ground after 50 minutes who thought the tie was going to penalties and we would remain in the hat."
“We let ourselves down with our quality once we got into the final third during the first half, while Gosport were ruthless.
“It looked impossible when they got their third goal just after the break, but that seemed to galvanise our lads.
“The intensity changed and we suddenly pounced on every mistake, won our duels and got numbers forward.
“Koby took his first goal really well and that was the catalyst. We dug in deep and found a gear that they maybe didn’t even know they had.
“Now we’ve done that, the expectation will be even greater for future games against senior men’s teams.
“There wouldn’t be many people in the ground after 50 minutes who thought the tie was going to penalties and we would remain in the hat.
“But there’s something about this football club and that never-say-die attitude. It’s easy to say things like that and it’s nice to see it happen on the pitch.”