Sean Raggett scored late in extra-time at Ipswich to send Pompey into the second round of the Emirates FA Cup.
The defender lashed the ball into the net just when it looked like penalties would be required to separate the two League One sides.
It did not look the contest was going to be a close when the Blues roared into a commanding lead through early Ronan Curtis and Tom Naylor goals.
But the Tractor Boys reduced their deficit through Jon Nolan and James Norwood came off the bench to draw them level after the break.
Kenny Jackett stuck with the same side that were so impressive in victory at Lincoln in the league on Tuesday evening.
That meant Cam Pring continued to deputise for Lee Brown – who injured his hamstring in the Sincil Bank warm-up – at left-back.
Oli Hawkins led the line for the hosts against his former club, while ex-Blues loanee David Cornell was between the sticks.
With Armistice Day approaching, there was a period of remembrance observed ahead of kick-off, while a bugler paid the Last Post.
And when the action started, Pompey got off to a blistering start and found themselves with a commanding lead inside the opening 13 minutes.
The first goal came after Ryan Williams was fouled 25 yards from goal by defender Mark McGuinness.
CURTIS stepped up to take the free-kick and managed to squeeze his effort between Cornell’s glove and the post.
The advantage was then doubled moments later, as Andy Cannon cut the ball back for NAYLOR to find the net – via a McGuinness deflection – from the edge of the area.
But that was Cannon’s last meaningful piece of action, as he soon limped off the pitch to be replaced by Ben Close.
The newcomer was immediately in the thick of the action, playing a fine pass through to Curtis, whose first time strike had to be turned behind by Cornell.
But the keeper – who did not make an appearance during his short stint with the Blues in 2015 – then almost saw a clearance charged down by the ever lively Ryan Williams.
Instead the ball flew to Marcus Harness and he won a corner that was taken by Cam Pring and headed clear by Hawkins.
Pompey were looking capable of adding to their lead, but instead found their advantage reduced just before the break.
Raggett intervened to stop Nolan’s header reaching Freddie Sears, but the ball flew straight back to the midfielder, who spun sharply and fired home.
Half Time: Ipswich 1 Pompey 2
The hosts then had a couple of opportunities to get back on level terms immediately after the restart.
Nolan’s effort was deflected narrowly past the post and Brett McGavin’s corner then almost snuck in at the near post, with Craig MacGillivray making the save with his legs.
Jackett soon made his second switch of the afternoon, as Callum Johnson made way and Haji Mnoga was given another chance to impress.
The game had quietened down a bit since Ipswich’s fast start, although a dangerous McGavin delivery into the box somehow evaded everyone on its path out of play.
Curtis showed some neat footwork at the other end of the pitch on 60 minutes, but his effort was comfortably dealt with by Cornell.
Hawkins was soon replaced by Norwood and the striker made an instant impact, racing between the Blues back-line and neatly slotting in an equaliser for the Tractor Boys.
Fellow substitute Gwion Edwards then came close to giving the hosts a lead, courtesy of a fierce strike that was beaten away by MacGillivray.
Ellis Harrison was also brought on to see if he could find a winner against his former club in the closing stages, with Curtis the man to head off.
It was Ipswich looking more likely to score again, though, and Emyr Huws nodded wastefully wide after meeting a McGavin corner.
And they almost did settle the tie in stoppage-time following a spot of pinball in the Pompey box, but Close was in the right place to stop the ball finding the net.
He then had a chance to score for the visitors a few moments later, but fired over from a Williams cut-back.
Full Time: Ipswich 2 Pompey 2
Teams are allowed to make an additional substitution if ties go into extra-time and Jackett immediately used his, swapping John Marquis with Bryn Morris.
And the visitors suddenly looked bright again, creating a few half-chances before Harness sent a shot crashing against the post.
Cam Pring then lifted a cross into the area from wide on the left, with Harrison rising to meet it and drawing a save from Cornell.
But the Blues did retake the lead in the second period of extra-time after Janoi Donacien had been booked for a foul on Harrison.
Harness’ delivery was met by Naylor, but his header was saved by Cornell. The loose ball was turned towards goal by Rasmus Nicolaisen, though, and RAGGETT made sure that it crossed the line.
And Mnoga almost added icing on the cake at the death, but could not keep his shot down after racing through on goal.
Ipswich (4-3-3): Cornell; Donacien, Nsiala (c), McGuiness, Kenlock; Huws (Judge 102), Nolan, McGavin; Bennetts (Edwards 67), Hawkins (Norwood 62), Sears (Lankester 94)
Goals: Nolan 43, Norwood 66
Booked: Hawkins, Donacien, Norwood
Subs not used: Holy, Wilson, Jackson
Pompey (4-2-3-1): MacGillivray; Johnson (Mnoga 50), Raggett, Nicolaisen, Pring; Naylor (c), Cannon (Close 23); Harness, Williams, Curtis (Harrison 74); Marquis (Morris 91)
Goals: Curtis 11, Naylor 13, Raggett 111
Subs not used: Bass, Downing, Hiwula
Referee: Andy Haines