HARTLEPOOL UNITED moved off the bottom of League One in the most dramatic of circumstances.
Trailing 1-0 to Leyton Orient, Pools looked set for defeat.
It means Pools are now five games unbeaten.
A seventh-minute penalty from Martin Rowlands, awarded for a harsh handball in the area by Neil Austin, appeared to separate the sides and the Os looked set to win.
Rowlands’ spot kick was the sixth penalty Pools have conceded at home in eight games.
The Os kept Pools at a distance for the most of the game, with central defender Scott Cuthbert producing a number of blocks when the home side were able to shoot.
The visitors were denied a second on 29 minutes, when goalkeeper Scott Flinders backpedalled to push out a goalbound Shaun Batt header from a lovely Gary Sawyer cross.
As half-time approached, Cuthbert excelled to stop goalbound shots from James Poole and twice from Jon Franks.
Second half openings were scarce for both sides.
But Evan Horwood swung over a corner for Hartley to power in and James, with 30 seconds of five minutes of added on time to go, they won it.
Horwood's ball was nodded down by substitue Steve Howard and James made no mistake to send Victoria Park into celebratory mode.
HARTLEPOOL UNITED: Flinders; Austin, Collins, Hartley, Horwood; Baldwin, Walton (Howard 62), Humphreys; Franks (James 81), Poole (Monkhouse 62), Wyke. Subs: McHugh (gk), Luscombe, Rutherford, Holden.
LEYTON ORIENT: Jones; Odubajo, Cuthbert, Baudry, Sawyer (Clarke 63); Cook, James Rowlands, Batt; MacDonald, Mooney (Smith 81). Subs: McSweeney, Vincelot, Griffith, Grainger, Omozusi.
Referee: Scott Duncan (Newcastle)