They dominated for much of the evening, but Lee Tomlin and Ivan Toney both struck to give the visitors a commanding lead.
Ben Close pulled one back before the break and a grandstand finish looked on the cards when Christian Burgess levelled.
Substitute Viv Solomon-Otabor then had a goal disallowed and Posh took advantage, with Toney netting again to condemn the Blues to the play-offs.
Kenny Jackett stuck with the same side that drew at Sunderland on Saturday, with James Vaughan continuing to lead the line.
Pompey came roaring out of the blocks and set about attacking a Peterborough side who got plenty of players behind the ball.
Brett Pitman diverted a Lee Brown delivery wide in the opening stages, while an effort from Ronan Curtis was blocked by Toney.
A quick break then saw another Brown cross nodded down by Vaughan, but Curtis’ shot struck team-mate Jamal Lowe.
It was pretty much one-way traffic and the hosts were only missing that clinical edge, with Nathan Thompson’s drive lacking enough power to trouble Aaron Chapman.
But the Fratton faithful were left stunned when Peterborough went ahead on 13 minutes, as Marcus Maddison cut the ball back for Tomlin to rifle home.
It looked as though Vaughan would level after more good work down the right from Lowe, only for a brilliant sliding challenge by Ben White to deny the striker his first goal for the club.
Instead it was Posh who were next to score when Maddison whipped a corner into the box and Toney was left in space to nod into the net.
Tomlin was not endearing himself to the home supporters and got away with kicking the ball away from a Blues free-kick.
But referee Dean Whitestone’s patience finally run out following another bout of time-wasting from the forward and brandished a yellow card.
Naylor fired over after Pitman brought down Matt Clarke’s cross, as Pompey tried to get back into the contest.
And they had a lifeline on 38 minutes, although it took an extremely scrappy goal to reduce the deficit.
Pitman swiped at a delivery from Curtis and completely mis-kicked the ball, but it landed for CLOSE to drive into the net via a deflection off White.
A quick break then almost provided a leveller in stoppage-time and after Lowe released Curtis, his low drive was saved by the foot of Chapman.
Peterborough United 2
There was a change at the break, with Vaughan failing to return and Oli Hawkins taking his place up front.
Curtis was first to try his luck with a free-kick from 30 yards that struck the wall and was deflected behind.
That was the last bit of action for the Irish winger, however, who was immediately replaced by Solomon-Otabor.
It was a similar to the first half, with Pompey looking to get at their opponents whenever possible and Hawkins nodded over from a corner.
Pitman then cut the ball back into the centre, where first Close and then Lowe saw efforts blocked in quick succession.
There was a spot of handbags following the award of a Blues free-kick, with both Maddison and Brown seeing yellow.
But the equaliser arrived seconds later, as Brown whipped the set-piece right into the mixer for Hawkins.
The tall striker was unable to get a shot away, but instead laid the ball off for BURGESS to drive into the net.
And there was almost another goal for the hosts soon after, with a dipping half-volley from Close narrowly clearing the crossbar.
Peterborough also needed to win, however, and when Craig MacGillivray could not hold Maddison’s drilled free-kick, Clarke had to hack clear.
But it was Pompey providing more of a threat, as the lively Solomon-Otabor cut in from the left and drilled narrowly past the post.
They almost came undone when nobody picked up Ryan Tafazolli from a Maddison free-kick and his thumping header bounced back off the bar.
What followed was an incredible couple of minutes that saw the hosts have a goal disallowed before falling behind again.
Pitman raced onto a Thompson pass and was sent through on goal, but rather than shoot he elected to slide the ball across to Solomon-Otabor.
The loanee had the simple task of sliding into an empty net, although he was in an offside position and the flag was raised.
As Fratton Park recovered from that blow, worse was to come, with Toney wriggling into space at the other end to fire Posh back in front.
Pompey tried their best to recover, but Peterborough saw out the closing stages and the hosts now have to prepare for the lottery of the play-offs.
Pompey (4-2-3-1): MacGillivray; Thompson, Burgess, Clarke, Brown; Naylor, Close; Lowe, Pitman (c), Curtis (Solomon-Otabor 54); Vaughan (Hawkins 46)
Goals: Close 38, Burgess 59
Booked: Brown, Lowe
Subs not used: Bass, Walkes, Morris, Evans, Bogle
Peterborough (4-4-2): Chapman; Naismith, White, Tafazolli, Lafferty; Maddison, Woodyard (c), Knight, Ward (Dembele 65); Tomlin, Toney
Goals: Tomlin 13, Toney 27, 75
Booked: Tomlin, Ward, Maddison, Woodyard
Subs not used: O’Malley, Bennett, Denton, Burrows, Cooke, Stevens
Referee: Dean Whitestone
Attendance: 18,396 (235 away fans)