A late strike from David Wheeler saw Pompey see off Peterborough to reach the semi-finals of the Checkatrade Trophy.
The visitors were finishing the tie on the ascendency, with Christian Burgess and the crossbar coming to the Blues’ rescue.
But a penalty shoot-out looked likely until Wheeler scored with five minutes remaining to bring Wembley a step closer.
Kenny Jackett made seven changes from the side that were beaten at Oxford in the league on Saturday.
Skipper Gareth Evans kept his place in the starting line-up, as did Craig MacGillivray, Jamal Lowe and Wheeler.
There was plenty of youth on display, with academy full-back Haji Mnoga joined by third year scholars Matt Casey and Dan Smith.
Burgess, Brandon Haunstrup, Ben Close and Adam May added a bit more experience to a youthful side.
It was Pompey who looked the bigger threat for much of the first half and a low Haunstrup cross was turned narrowly past his own post by Rhys Bennett.
Evans then curled a free-kick just past the upright, while a scuffed May effort hit Smith’s heel and rebounded clear.
Their first clear-cut opportunity arrived on 22 minutes when Burgess lofted a fine pass over the Posh defence to find Wheeler.
The winger brought the ball down neatly, but Conor O’Malley was quickly off his line to block the shot.
Lowe then cut inside from the left and hit a fierce effort that was diverted over the bar by Ryan Tafazolli.
And Haunstrup found space to surge forward on 34 minutes, then flashed a low shot just past the post.
But Peterborough started to look dangerous as the interval approached and Joe Ward’s cross almost caught out MacGillivray.
The ball drifted towards goal, forcing the keeper to push it against the bar, with Wheeler clearing behind before Daniel Lafferty could pounce.
Lee Tomlin then found George Cooper with an incisive pass, but the midfielder’s first touch was heavy and the opportunity disappeared.
Peterborough United 0
It was the Blues who were first to have a chance after the interval, although Wheeler could not keep his shot down after Haunstrup’s pass had been fed into his path by Smith.
Burgess was enjoying a chance to impress and showed some silky footwork to twice leave Tomlin floundering.
The Posh winger was not amused, however, and kicked out at his opponent, with referee Andy Woolmer surprisingly deciding that a talking was all that was required.
And the official also kept his cards in his pocket moments later when Ivan Toney clattered into Burgess.
Jackett made a double substitution just before the hour mark, with Smith and Mnoga making way for Louis Dennis and Anton Walkes.
Toney had a couple of attempts for the visitors, scuffing one comfortably wide before a curling a second narrowly over.
Genuine chances were proving to be at a premium, though, and Evans sent a shot off target, while Close had an effort blocked.
Cooper wasted a good chance for the visitors by blazing wide after being teed-up by Siriki Dembele and tried to claim a corner to spare his blushes.
But the hosts somehow avoided falling behind during an incredible passage of play on 81 minutes.
MacGillivray did well to deny Cooper and Toney in quick succession, before Jason Naismith’s effort was cleared from the line by Burgess.
But the ball fell back to the Posh right-back and his header hit the bar, with Burgess again on hand to hack clear.
It was Pompey who broke the deadlock on 85 minutes, however, as Evans’ corner from the left was emphatically converted by WHEELER’s first-time finish.
The lead might have been doubled, but Dennis sent a shot just over the bar, while O’Malley denied Wheeler again.
One goal was enough, though, as the Blues comfortably saw out the final moments to reach the last four.
Pompey (4-2-3-1): MacGillivray; Mnoga (Walkes 58), Casey, Burgess, Haunstrup; May, Close (Clarke 87); Wheeler, Evans (c), Lowe; Smith (Dennis 58)
Goals: Wheeler 85
Subs not used: Bass, Donohue, Read, Lethbridge
Peterborough (4-2-3-1): O’Malley; Naismith, Bennett, Tafazolli, Lafferty; Woodyard (c) (Godden 87), Cooke; Ward, Cooper, Tomlin (Dembele 69); Toney
Subs not used: Chapman, Lyon, Denton, Maddison, Stevens
Referee: Andy Woolmer
Attendance: 3,313 (121 away fans)
FA Cup 1
Pompey eased their way into the second round of the Emirates FA Cup with a 4-0 victory over Maidenhead.
But the National League strugglers made the Blues work hard for their opening goal at York Road, with Ben Thompson finally netting just before the break.
It was less of a struggle in the second half, though, with Oli Hawkins, Jamal Lowe and David Wheeler all finding the target.
Kenny Jackett made a single change from the side that won at Bradford in the league the previous week.
Nathan Thompson – back from a one-match ban – replaced Anton Walkes at right-back, with the visitors clearly taking the game seriously.
Gareth Evans skippered the side on his 150th appearance for the club, while former Pompey striker Ryan Bird was among the Maidenhead substitutes.
Both captain’s laid a wreath on the pitch before kick-off and the teams wore poppies on their shirts, while a minute’s silence was held to commemorate Remembrance weekend.
When the action got underway, it was Pompey who dominated possession without being able to carve open many clear-cut chances.
Carl Pentney was being well protected, although the keeper comfortably claimed a Hawkins effort before punching clear under pressure from the same player.
The first noteworthy incident came on 18 minutes, when the tricky Ronan Curtis got free down the right and crossed for Hawkins, whose header was deflected behind.
And they should really have forged ahead midway through the first half, with Tom Naylor the guilty party.
He failed to connect with an ambitious over-head attempt, but when Evans’ shot was parried into his path moments later, the midfielder turned the ball against the crossbar from a few yards out.
Maidenhead then came close to scoring again soon after, with Ayo Obileye’s strike crashing against the post.
Remy Clerima was also causing problems with a series of long throws, while Nathan Thompson was unable to beat Pentney from a tight angle at the other end.
Pompey won a succession of corners as the half progressed and the heavens opened, although were being frustrated in their attempts to test Pentney.
But the deadlock was finally broken just before the interval, as Curtis whipped in a low cross and Ben THOMPSON fired home to open his account for the club.
Maidenhead United 0
The second half was slow to really click into gear, although it was still the Blues seeing most of the ball.
And they doubled their lead on 55 minutes, with Evans crossing from the right and HAWKINS sending a header looping over Pentney and into the net.
That gave the visitors a cushion, but their lead was even more comfortable when a third went in on the hour mark.
Ben Thompson sent a free-kick into the box and Jack Whatmough nodded the ball down for LOWE, who turned and sent a neat finish into the bottom corner.
Jackett decided the time was right to make a double change, with Lowe and Evans withdrawn for Brett Pitman and Wheeler.
Pompey’s play was more patient with such a commanding advantage, but they were still looking to get forward.
And when they were unable to find a path through the Magpies defence, Ben Thompson hit a long-range shot that was saved by Pentney.
The keeper also kept out a header from Pitman after he had been spotted in the box by Lee Brown.
Pompey’s captain also fired a shot narrowly over the bar after Nathan Thompson won the ball back when a fine passing move came to an end.
The same duo combined again moments later and this time Pentney was forced into a decent save low to his left to keep out Pitman’s sweet first time strike.
But it was WHEELER who wrapped things up on 83 minutes, stooping to head home after Brown’s free-kick had been superbly saved.
There was still time for Pitman to steer narrowly wide following a mad scramble in the box, but the visitors could be happy with their afternoon’s work.
Maidenhead (4-1-4-1): Pentney; Clerima, Kilgour, Massey (c), Steer; Obileye; Odametey, Comley (Owusu 54), Clifton (Bird 67), Upward (Akintunde 46); Kelly
Subs not used: Hamann, Mulley, Alves, Worsfold
Pompey (4-2-3-1): MacGillivray; N.Thompson (Burgess 85), Whatmough, Clarke, Brown; B.Thompson, Naylor; Lowe (Pitman 63), Evans (c) (Wheeler 63), Curtis; Hawkins
Goals: B.Thompson 43, Hawkins 55, Lowe 60, Wheeler 83
Subs not used: McGee, Haunstrup, Close, Dennis
Referee: Dean Whitestone
Attendance: 3,205 (710 Pompey fans)
Checkatrade Trophy Group
Pompey eased to victory over Gillingham in their opening Checkatrade Trophy group match at Fratton Park.
A largely uneventful first half came to life right at the end, with Matt Clarke and Ben Close finding the net in quick succession.
Brett Pitman then hammered home a penalty after the interval to erase any hopes of a Gills comeback.
And a comfortable evening was wrapped up right at the end when David Wheeler opened his Blues account.
Kenny Jackett made 10 changes from the side that comfortably saw off Plymouth in the league at the weekend.
Clarke was the only player to keep his spot, with loan sign Andre Green handed his debut in an attacking role.
Pitman reclaimed the captain’s armband up front, while fellow striker Joe Mason had to be content with a place among the substitutes.
The crowd were packed into the South Stand, but there was not too much to keep them entertained for the majority of the first half.
Pitman thundered a 30-yard free-kick against the crossbar after Wheeler had been fouled by Aaron Simpson.
But that was not typical of a listless opening period that only exploded into life just before the interval.
Neither keeper had much to deal with, although Luke McGee made a regulation save to deny Navid Nasseri.
Pompey finally moved through the gears on 41 minutes when Adam May slipped a fine pass down the line for Wheeler.
His low centre was intended for Pitman, who would have been left with a simple finish had Alex Lacey not cut the ball out.
But the deadlock was broken from the resulting corner, as CLARKE was left untroubled to convert May’s delivery.
And the celebrations from the home supporters had barely died down before the Blues doubled their advantage.
Nathan Thompson crossed from the right and although CLOSE’s first time effort lacked power, it was neatly placed into the bottom corner.
It might have been even better in stoppage-time, but a long-range effort from May flashed past the post.
There were only a few minutes on the clock when the hosts had a great chance to extend their lead further.
Wheeler whipped in a teasing cross from the right that would normally have been gobbled up by Pitman, but he fired uncharacteristically wide from a few yards out.
Pompey’s skipper made up for that, however, by opening his account for the season from the penalty spot on 55 minutes.
Alan Young pointed to the spot when Green went down under Aaron Simpson’s challenge, with PITMAN on hand to slam home from 12 yards.
Gills keeper Tom Hadler then came tearing from his line to stop Wheeler reaching Green’s threaded pass.
Mason was introduced for his Blues bow just past the hour mark, with May the man to make way for the on-loan Wolves striker.
The tempo of the contest unsurprisingly dropped with the lead so commanding and the chances started to dry up again.
Wheeler came close to adding a fourth goal after bundling his way into the box, but Hadler came to the rescue with a decent stop.
And that is exactly what he did at the death, with WHEELER on hand to net from close range after Mason’s blocked shot had fallen into his path.
Pompey (4-2-3-1): McGee; N.Thompson, Burgess, Clarke, Haunstrup; Close, Rose; Wheeler, May (Mason 62), Green; Pitman (c)
Goals: Clarke 41, Close 43, Pitman 55 (pen), Wheeler 90
Subs not used: MacGillivray, Brown, Naylor, B.Thompson, Evans, Lowe
Gillingham (4-1-2-1-2): Hadler; O’Neill (c), Lacey (Scarlett 80), Ogilvie, Simpson (Nash 65); Oldaker; Rees (Chapman 62), Stevenson; Nasseri; Wilkinson, List
Subs not used: Holy, O’Mara, Woods, Mbo
Referee: Alan Young
Attendance: 2,011 (69 away fans)
Loan : Queens Park Rangers – Portsmouth