The home side stormed into a two-goal advantage through George Oakley and a Dougie Imrie penalty only for Livingston to hit back to lead through a Scott Pittman double and a Steve Lawson strike.
But, with defeat looming for the hosts, full-back Aaron McGowan’s deflected shot earned them a point.
The result leaves 10th-placed Hamilton nine points clear of bottom side Dundee with just three games left to play, while they are two points clear of second-bottom St Mirren.
There was a worrying development ahead of the match, though, as Hamilton’s goalkeeping coach Brian Potter appeared to collapse during the warm-up and left the field on a stretcher while receiving oxygen, with kick-off delayed by five minutes.
Hamilton made four changes from the side that drew 1-1 with Motherwell. In came goalkeeper Ryan Fulton, Oakley, Alex Gogic and Marios Ogkmpoe for regular keeper Gary Woods, Matt Kilgallon, Steve Davies and David McMillan.
Livingston made just one enforced change, Hakeem Odoffin in for the suspended Craig Halkett.
The home side made a strong start. Oakley was the first to threaten with a header that sailed over before goalkeeper Liam Kelly did just enough to push over Tony Andreu’s powerful drive.
Kelly then did brilliantly to push away Ogkmpoe’s lob that seemed to be drifting in and was then alert to keep out Darian MacKinnon’s downwards header.
A goal was coming, though, and it arrived five minutes before half-time. Livingston failed to clear a dangerous Andreu corner and Oakley was alert to stab in the loose ball from close range.
Hamilton went further in front two minutes after the restart. Odoffin was clumsy as he tried to dispossess Ogkmpoe in the area and referee Greg Aitken awarded a penalty. Imrie took responsibility and finished well.
Livingston grabbed a lifeline after 57 minutes, Ryan Hardie laying the ball off for Pittman to score with a low shot.
That spurred the visitors on and they were level 11 minutes later as Hamilton inexplicably wilted. Lawson was allowed to run unchecked into the area and his low shot zipped past Fulton.
The momentum was all with Livingston now and they went in front after 72 minutes with the goal of the game. Substitute Dolly Menga made space to dig out a deep cross and Pittman’s volley sailed past Fulton with the aid of a deflection.
Accies looked sunk but somehow found an equaliser in the final minute. McGowan’s shot looked to be drifting wide only to bounce off the unfortunate Odoffin and nestle in the net.