A Murray Davidson header just six minutes from time earned St Johnstone a victory which lifts them to second place in the Ladbrokes Premiership.
Greg Docherty gave Hamilton a deserved lead in the 24th minute but second-half goals from Steven MacLean and Davidson turned things around after the break and gave the hosts a 2-1 success, with the visitors seeing Darian MacKinnon sent off in injury-time for a last-man foul on Paul Paton.
Hamitlon started strongly at McDiarmid Park and threatened to make the breakthrough long before they actually got it.
Just two minutes had gone when Louis Longridge stole in front of Steven Anderson to flash a header from Docherty’s cross over the bar, then St Johnstone had goalkeeper Alan Mannus to thank in the 18th minute when he blocked a Rakish Bingham header with his chest.
The first half turned on chances at either end of the pitch just seconds apart midway through the half.
After home midfielder Paton punted a ball over the top of the Accies defence, Graham Cummins beat Gary Woods in a challenge for the bouncing ball. The striker got there first and nodded the ricochet towards goal – but keeper Gary Woods recovered to get back in time before the ball crossed the line.
Within a minute, Hamilton were in front. Docherty took possession on the left and cut inside before firing a shot across Mannus into the far corner of the net.
Although Accies were on top, Saints came within a whisker of an equaliser seven minutes before the break.
Davidson’s tackle in the centre circle sent the ball spiralling over the top of the Hamilton defence and MacLean was first to react. However, after surging into the box, the striker’s eventual shot crashed back off the crossbar and Cummins could not direct the rebound on target.
Within seconds of the restart, Saints should have been level. Paton’s cross from the left picked out Cummins but the striker’s header flew just wide.
Two minutes later, the visitors came close to doubling their advantage when Xavier Tomas’ header from Alistair Crawford’s corner clipped the top of the crossbar.
Moments later, Saints were level. Cummins chipped in a cross from the left to find MacLean on his own six yards out. Although Woods produced a brilliant save to block the header, the striker somehow scooped the rebound in whilst lying on the ground.
Mannus denied Bingham with a superb stop after the Accies striker had been played into space in a lightning-quick attack and at the other end Alex Gogic blocked MacLean’s shot on the line.
But, with just six minutes remaining, Davidson rose highest to meet a cross from substitute Scott Tanser and headed in from eight yards out.
And the misery for the visitors was complete in injury-time when MacKinnon was sent-off for pulling down Paton as the visitors’ last defender.