Connor Ogilvie headed home a last-gasp winner against his former club, as Pompey enjoyed a pre-season triumph at Gillingham.
Reeco Hackett had earlier fired the Blues into an interval lead, only for Olly Lee to draw the League Two hosts level.
The 248 fans who made the journey from Hampshire were treated to a first sight of new loan signings Josh Griffiths and Joe Pigott.
Hackett also made his maiden appearance of pre-season, having fully recovered from the knee problem that saw him miss the end of last term.
It was the hosts who made the quicker start, with a Jordan Green effort deflected wide and a thumping Lee shot heading straight at Griffiths.
There was also a cheeky long-range attempt from former Blues midfielder Shaun Williams that flew well off target.
But Pompey soon began to settle and started showcasing some neat football, with Pigott covering plenty of the pitch.
An ambitious effort from the new signing flew over, while Hackett was eventually crowded out after tricking his way into the area.
HACKETT did break the deadlock on 27 minutes, however, slotting the ball home after being sent clear by a fine Michael Jacobs pass.
Ronan Curtis tried to double the lead after spying Jake Turner off his line, but was unable to hook his shot on target.
Gillingham’s best chance to find a leveller came just before the break, with Green slotting just past the post.
Half Time: Gillingham 0 Pompey 1
There were a couple of changes at the break, with Hackett and Zak Swanson making way for Ryan Tunnicliffe and Joe Rafferty.
The visitors continued to play on the front foot and an effort from Jacobs was blocked following good Curtis work.
A low Pigott strike was then heading for the net, only for Turner to get down to his left and deny the newcomer.
Pompey were passing the ball about with ease and looking comfortable in possession, only for the usual raft of changes to halt their rhythm.
That allowed the Gills to work their way back into the contest and a Ben Reeves effort was deflected just past the post.
The resulting corner could not be fully cleared and a header from Mikael Mandron was superbly tipped over by Toby Steward.
But the hosts did level from that flag-kick. It was not clear who actually converted Lee’s corner or if the ball flew straight in.
Both sides tried to get forward as the seconds ticked down, although it looked like a late winner would not be forthcoming.
With almost the last touch of the match, though, OGILVIE rose highest in the box to nod home a deep Rafferty delivery.
Gillingham (4-2-3-1): Turner; Alexander (Akehurst 66), Wright (Carter 75), Baggott, Tutonda (Giles 75); O’Keefe (c), Williams (Jefferies 66); Green (MacDonald 62), Lee (MacArthur 86), Kashket (Mandron 62); Gbode (Reeves 62)
Goals: Lee 71
Sub not used: Holtam
Pompey (4-4-2): Griffiths (Steward 66); Swanson (Rafferty 46), Mnoga, Robertson (c) (Trialist 66), Ogilvie; Hackett (Tunnicliffe 46), Pack, Thompson (Bridgman 66), Jacobs (Jewitt-White 76); Pigott (Gifford 66), Curtis
Goals: Hackett 27, Ogilvie 90
Subs not used: Freeman, Mingi
Referee: Tim Robinson
Attendance: 1,356 (248 away fans)