Fielding an Academy team, they trailed 3-0 after 69 minutes of the Hampshire Senior Cup second-round clash at Privett Park.
The hosts, unbeaten in seven previous matches this season, were well worth their comfortable lead on what was proving a tough evening for the youthful Blues.
When Koby Mottoh netted with 21 minutes it appeared to be nothing more than a consolation – but there was drama to come.
On 82 minutes, substitute Connor May converted Sam Folarin’s pass, yet Pompey’s deficit was 3-2 entering stoppage time.
Then Mottoh finished a penalty after Harry Medway had handled his initial shot against the bar, earning Gosport’s skipper his marching orders.
With the match 3-3, it was now onto a penalty shoot-out, with Pompey running out 4-3 winners in front of a crowd of 701.
And fittingly, it was Mottoh who netted the decisive spot kick, adding to his two previous goals, as Sam Hudson’s kids dragged themselves into the third round.
Of the Pompey XI side, only Mottoh had first-team experience, following his three cup outings last month.
Others, such as Sam Folarin, Dan Murray, Jack Fox and Mitch Aston, had featured in pre-season for the Blues as part of their friendly programme.
The visitors had a decent opportunity on five minutes when Kev Bosaka’s deep cross from the left was arrowed towards the far post, yet Folarin couldn’t make a headed connection.
However, it was Gosport who were enjoying the better of early exchanges, with Bastian Smith busy in Pompey’s goal.
Firstly the keeper parried Antonio Diaz’s deflected shot, with Bosaka blocking the follow-up on the line, although the linesman’s flag had already been raised for offside.
Then Smith pulled off a smart stop diving to his left, while moments later saved Rafa Ramos' header low down.
When Ramos finally did beat Smith with a header, Spencer Spurway was there with an acrobatic clearance off the line when all had appeared lost.
However, Boro deservedly took the lead on 24 minutes after Barsa was allowed to take several touches in the box before firing a low right-footed shot into the far corner to make it 1-0.
It was proving comfortable for Gosport and they increased their lead on 41 minutes when Kurtis Cumberbatch put a cross into the box and Medway’s flicked header looped over Smith.
With half-time approaching, Mottoh whipped in a cross from the right which was punched out by the flying Callum Smart to avert the danger.
It was 2-0 at the break and within two minutes of the restart Ramos had further increased Gosport’s lead.
Alexandr Barsa managed to get the better of Fox to find room to dig out a cross from the right which was headed home superbly by Rafa Ramos to make it 3-0.
On 69 minutes, Mottoh reduced the deficit with an excellent angled right-footed shot found the far bottom corner to make it 3-1.
Then, with eight minutes left, Folarin stole possession down the right and selflessly squared to substitute May to make it 3-2.
As the match entered stoppage time, Mottoh fired in a shot which was pushed against the bar by the hand of centre-half Medway, who subsequently received his marching orders.
Mottoh stepped up for the penalty, sending Smart the wrong way, and it was 3-3 - now heading into a penalty shoot-out.
Zak Sharp and Jake Wright both missed for Boro, while Smith struck the bar for the visitors – and it was left to that man Mottoh to claim victory in such dramatic circumstances.