Saints’ grip on a top-six place loosened as they crashed to their fourth successive defeat with Hamilton ending a run of 10 games without a win.
Perth boss Tommy Wright said: “I was expecting things to happen and for the players to grab the game, but they didn’t do it.
“We have only ourselves to blame in a game where there wasn’t many chances.
“It was a catalogue of small mistakes that led to both of their goals.
“We were far too deep and conceded goals which were easily preventable from our point of view.
“We had a lot of good possession but didn’t make enough of it in the last third.
“I thought there was lack of understanding in what we want them to do with too many people going to the ball.
“The main thing was we expected things would happen. Life’s not like that and football’s not like that. You have to make it happen.”
Saints had previously chalked up seven straight victories over the Lanarkshire outfit, including a 2-0 win in the Scottish Cup last month.
Michael O’Halloran and Liam Craig returned to the visitors’ starting line-up from Sunday, with Murray Davidson left out and Danny Swanson relegated to the bench.
Accies, under new coach Brian Rice, had been in freefall and firmly locked in a three-way relegation battle with Dundee and St Mirren.
Accies had not managed a victory in their last 10 outings before last night, since their win at St Mirren on December 1.
Hamilton, with just three wins over the Saints in their previous 21 clashes, almost went behind after just five minutes when woeful defending allowed Tony Watt space to squeeze the ball through to Craig, but goalkeeper Gary Woods blocked his close range effort with his feet.
Zander Clark was brought into action after 10 minutes when Aaron McGowan floated a cross from the right to the back post, but Steve Davies was unable to direct his header past the Saints goalkeeper.
The hosts threatened again in 26 minutes when Davies cleverly chested the ball down into the path of Steven Boyd, but the midfielder hooked his shot wide from 18 yards.
Four minutes later the impressive Boyd cracked a shot on target from 20 yards, but Clark held it at the second attempt.
Saints continued to be under the cosh and in 32 minutes George Oakley was held up at the edge of the area by Craig, but managed to roll the ball into the path of Davies, but he fired wide of Clark’s right hand post.
Prior to the recent back-to-back defeats at Hearts and Celtic, Wright’s men had racked up six successive wins on the road in an impressive run of form which they were anxious to regain.
But chances in the first period were thin on the ground for Saints.
After 34 minutes Scott Tanser found space on the left to pick out Craig, but his 15-yard shot was off the mark.
Saints might have edged in front two minutes after the restart when Accies defender Lenny Sowah hesitated and allowed Matty Kennedy to nip in behind him, but the striker lost his balance and hooked the ball over the bar from 12 yards.
The Perth men continued to grow into the match and in 58 minutes Kennedy showed a terrific turn of pace down the left, cut inside, blasted wide of the far post.
But Accies remained a threat and in 61 minutes, after Joe Shaughnessy hauled down Oakley 20 yards out to earn a booking, Boyd’s free-kick spun off Watt’s head in the defensive wall and dipped just over with Clark wrong-footed.
Boss Wright made a positive switch in 66 minutes when he took off Jason Kerr and threw on striker Chris Kane. But it was Accies who finally made the breakthrough in 68 minutes when substitute Mickel Miller drilled a low cross in from the left for Oakley to direct the ball past Clark from six yards.
Saints responded superbly and eight minutes later were level when Kane turned brilliantly on the right and picked out Craig running in from the left to ram the ball home.
But the lead lasted just three minutes when Oakley got his second, a carbon copy of the first, except this time substitute Tony Andreu being the supplier from the left.
Accies boss Rice said: “It’s my first win as head coach and I will not forget it. It was massive.
“They threw the kitchen sink at us, but we held on. We deserved it.”