In an incident-packed game that saw both sides reduced to 10 men, the Rams came from 3-0 down to level the scores late on at Love Lane.
But with the hosts in the acendancy, they were hit with a last-gasp sucker punch as Histon – who began the day at the foot of the table – struck at the death to leapfrog their relegation rivals.
The visitors were ahead after just five minutes when Petersfield’s defence failed to clear danger from a corner and Matty Allan tucked the ball past goalkeeper Jamie Bray and into the net.
Seven minutes later, former Pompey midfielder Nick Awford was shown a harsh-looking straight red card for a challenge on the touchline – with the referee swayed by the vocal protest of the visitors.
With a man advantange, Histon doubled their lead on 15 minutes when a cross from the left went across the face of goal and James Carman slid the ball home at the far post.
It was 3-0 two minutes later when the visitors broke down the left, before the ball fell to Shaun Jenkins and he hit a first-time shot past Bray.
With the game seemingly won, Histon were then reduced to 10 men themselves when Lawrence Larbi was sent racing clear for Petersfield and visiting keeper Niall Conroy raced out of his box, felling the Rams man to receive a straight red card.
From the resulting free-kick, new signing Zach Nicholson-Pibworth expertly converted from 25 yards out.
Ten minutes into the second half, Histon almost had a fourth goal when Adam Capel curled a free-kick in from the right which beat Bray but struck the crossbar.
Petersfield, though, reduced the arrears on 72 minutes when Billy Connor found Will Essai, who sent a fierce shot low into the net.
On 83 minutes the visitors should have restored their two-goal advantage when Capel tried a backward header at the far post but somehow missed the target.
Instead, quick play from the Rams saw substitute Adam Cripps break down left and his cross found Matt Andrews who thumped a leveller into the bottom corner of the net.
There only looked likely to be one winner at that stage.
But straight from kick-off, Histon went up the other end and Allan rode a couple of challenges before beating Bray low at his near post to snatch all three points.
Meanwhile in Wessex League division one, Baffins Milton Rovers beat Tadley Calleva 1-0 on home soil thanks to Blu Boam’s goal.