Pompey scored in the final seconds of stoppage-time to beat Gillingham extend their winning run to six games.
It looked like a contest that was full of effort and desire – if a little short on quality – was going to end all square.
But some good play from substitute Michael Jacobs and a deflection from Jack Tucker saw the Blues find the net right at the death.
Danny Cowley made one change from the side that impressively won away at Lincoln earlier in the week.
With Sean Raggett serving a one-match ban, Louis Thompson returned to the starting line-up and Shaun Williams dropped back into defence.
Lee Brown had completed his own suspension, although a back injury saw him initially named on the bench, only to then be replaced by academy midfielder Harry Jewitt-White.
And with Clark Robertson also still on the sidelines, it meant the captain’s armband was worn by Ronan Curtis.
There were a couple of familiar faces in the hosts’ side, with former Fratton loanees Stuart O’Keefe and John Akinde both starting.
Pompey made a fast start and had a couple of excellent chances to break the deadlock in the opening stages.
George Hirst looked to make the most of a poor Robbie McKenzie header and lifted a shot towards goal, but Jamie Cumming managed to push it against the crossbar.
The ball then hit the arm of Tucker as he tried to clear, but referee Dean Whitestone decided it was not deliberate.
Joe Morrell soon slipped a neat pass through to Hirst, who cut inside and fired in an effort that was beaten away by Cumming.
And the keeper then recovered well to deny Mahlon Romeo after the loose ball fell kindly for the wing-back.
But Gillingham fought their way back into the contest and began to dominate proceedings as the first half progressed.
They were pegging the visitors back into their own half, but without being able to test Gavin Bazunu between the sticks.
Marcus Harness had an opportunity at the other end after being teed-up by Morrell and dragged a shot past the post.
But the Gills had a better chance to forge ahead on 35 minutes, as Akinde held off a couple of challenges and charged forward, only to hit a tame attempt straight at Bazunu.
A couple of low Williams corners in quick succession then found Curtis and Reeco Hackett, but neither could make a clean connection.
Half Time: Gillingham 0 Pompey 0
Just as they had before the break, Pompey started the second half strongly and almost took the lead within three minutes of the restart.
It was a great run from Harness, who saw space open up in front of him before hitting a shot that was excellently palmed away by Cumming.
The ball then ricocheted into the path of O’Keefe, whose low effort was kept out in relatively comfortable fashion by Bazunu.
Gillingham felt they should have been awarded a penalty when Akinde took a tumble over Bazunu just past the hour mark.
But Bazunu had definitely got to the ball just before the striker and Whitestone correctly waved away their noisy appeals.
Cowley made his first substitution soon after that, with Thompson being replaced by Arsenal loanee Miguel Azeez.
And with the contest still delicately poised, a second switch followed on 71 minutes, as Hirst made way for Harrison up front.
The game was lacking a bit of quality, summed up by Danny Lloyd’s wild finish when found in a good position by Akinde.
Pompey’s final change saw Jacobs – who scored at Priestfield last season – come on for Hackett.
And the newcomer had an immediate chance to be the late hero, but could not connect with Morrell’s low cut-back.
There was anger from the Blues when they had the ball on the edge of the Gills box, only for Whitestone to stop the play so Max Ehmer could receive some treatment.
They tried to attack from the resulting drop ball and despite taking a fine first touch, Harness was unable to squeeze his way through the back-line.
And Connor Ogilvie then tried to nod back a Romeo cross for Harrison, but the ball flew just behind the striker.
Then, with just a few seconds of the contest remaining, JACOBS showed some neat skill by the touchline and sent the ball into the centre, where it hit Tucker and flew into the net.
It was arguably harsh for Gillingham, but the large number of travelling fans who had spent the afternoon shivering on the open stand behind the goal did not seem to care.
And there was barely time for the contest to restart before the final whistle blew to lengthen Pompey’s fine run.
Gillingham (4-2-3-1): Cumming; Jackson, Ehmer, Tucker, McKenzie; Adshead (Akehurst 59), O’Keefe (c); Lloyd, Lee, Carayol (Sithole 83); Akinde
Subs not used: Chapman, Lintott, Gale, Gbode
Pompey (3-4-1-2): Bazunu; Freeman, Ogilvie, Williams; Romeo, Thompson (Azeez 64), Morrell, Hackett (Jacobs 81); Harness; Curtis (c), Hirst (Harrison 71)
Goals: Jacobs 90+3
Subs not used: Bass, Vincent, Jewitt-White, Gassan
Referee: Dean Whitestone
Attendance: 5,637 (1,435 Pompey fans)