It was only Scunthorpe's second home win of the season - their first since September 20 - and was enough to lift them out of the bottom four.
But it was tough luck on Pompey, who looked set to halt their miserable run of seven successive league defeats.
In a dour affair between two struggling teams at Glanford Park on Tuesday night, it was Scunthorpe who broke the deadlock in the 40th minute when Sodje, playing against his elder brother Sam in the Portsmouth defence, raced in at the near post to head home a left-wing cross from full-back Callum Kennedy.
But a stunning equaliser on the stroke of half-time brought Portsmouth back on level terms when Liam Walker rifled a 30-yard free-kick into the top corner.
Pompey then had huge appeals for a penalty turned down early in the second half when they claimed a shot from James Keene had been blocked by an arm in a crowded box.
The visitors held on ruggedly at times until the 85th minute when Sodje struck again with a winner, getting his head to a hopeful high ball into the box from Kennedy.