St Johnstone left it late to get back to winning ways at McDiarmid Park and jump into second in the Premiership table.
An 84th minute Murray Davidson header secured the points for Tommy Wright’s men after Steven MacLean had cancelled out Greg Docherty’s first half opener.
The win was a deserved one in the end given the pressure Saints applied in the second 45 and takes them above Aberdeen on goals scored.
The team lines brought disappointing news for Saints fans, with star man Michael O’Halloran missing out through injury. Graham Cummins and Davidson returned to the starting line-up.
There was little goalmouth action of note in the early stages and it wasn’t until the 18th minute that either keeper was put under serious pressure. Ali Crawford put a ball over the top and Alan Mannus was caught in two minds over whether to come for it or not. In the end Rakish Bingham’s shot struck his chest.
Saints came close to scoring a few minutes later when Cummins chased down a Paul Paton through ball, beat keeper Gary Woods to the bouncing ball and won a second header in the box, under pressure from Alex Gogic. The goal-bound effort didn’t have enough on it to cross the line, though, with Woods getting back just in time to save.
From nearly going ahead, Saints were a goal down within seconds when Docherty drilled a diagonal left-footer past Mannus from just inside the box.
There was a glorious chance for a home equaliser on 38 minutes when MacLean was put through one on one with Woods. He struck the face of the crossbar with his shot and then strike-partner Cummins blasted the rebound over.
Within two minutes of the re-start both sides came close with headers – Cummins for Saints and Xavier Tomas for Accies.
The Perth men got their equaliser on 49 minutes. Cummins picked out MacLean unmarked at the back post with a cross from the left. The header was brilliantly saved by Woods but the centre-forward, who by this time was sat on his backside, somehow managed to stab the ball over the line.
Saints took control after scoring but on a rare Hamilton counter-attack Mannus was forced to make a fine save when Docherty released Bingham in the box on 73 minutes.
Three minutes later MacLean nearly scored his second after a back post shot was cleared off the line by Gogic.
Both sides were pushing for the winner and Davidson thwarted a certain goal with a perfectly-timed block on Bingham as he was about to pull the trigger.
It was Saints who came up with the decisive finish though on 84 minutes when Davidson headed home a Tanser cross from close-range.
The Perth side had to defend their box in the closing stages and the job was made a bit easier in injury time when Darian Mackinnon was red-carded for a foul on Paul Paton.