For the fifth time in seven matches, Saints fought back after falling behind, but Accies were not to be denied their highest-ever SPL finish and an extra £80,000 in prize money thanks to James Wesolowski's 84th-minute winner at McDiarmid Park on Saturday.
The visitors were 2-0 up inside 15 minutes through Mark McLaughlin and Dougie Imrie but Saints levelled after the break with goals from Murray Davidson and a Liam Craig penalty.
Hamilton took an eighth minute lead thanks to McLaughlin's second goal of the season.
Graeme Smith turned Marco Paixao's fabulous 25-yard free-kick over the crossbar and the resulting corner was also cleared.
But Alex Neil hooked the ball goalwards and McLaughlin back-headed it over the stranded Smith and into the empty net.
Imrie almost set up a second for Accies four minutes later but Simon Mensing and Paixao's twin brother Flavio both failed to connect with the striker's low cross.
Imrie thought he had won a penalty when Gartland tripped him on the edge of the box but referee Willie Collum awarded a free-kick millimetres outside the area.
It did not matter as Imrie stepped up to curl a brilliant strike into the top corner on the quarter hour.
Saints had fallen behind in six of their last seven games and had lost only one of them.
But it took them 24 minutes to fashion a genuine shot on goal, Milne forcing the backpedalling Sean Murdoch into a good save from almost 30 yards.
An under-pressure Davidson found the sidenetting from a tight angle three minutes later when Murdoch spilled Craig's crossed free-kick.
Chris Millar and Wesolowski escaped with a lecture after clashing on the touchline and Saints boss Derek McInnes also got a talking to for taking issue with a challenge between Neil and Collin Samuel, which saw the latter require treatment.
The home fans were screaming for Murdoch to be punished a minute before half-time after the keeper took a catch right on the edge of his box - and possibly outside - but Collum gave him the benefit of the doubt.
McInnes brought on Kenny Deuchar for Gartland at half-time as Saints went on the attack.
It took them less than four minutes to pull a goal back, the unmarked Davidson rising to nod Millar's pinpoint cross home from six yards.
A frantic two-minute spell then saw both sides go close.
Dave Mackay forced a great reflex save from Murdoch, with James McArthur on hand clear the loose ball, before Marco Paixao somehow contrived to miss Imrie's cross from point-blank range.
Having escaped in the first half, Murdoch incredibly carried the ball outside the box in the 63rd minute and this time the keeper was booked.
His nightmare afternoon continued four minutes later when he needlessly clattered into Deuchar as the striker chased Millar's clipped ball.
Collum pointed to the spot and although Craig's poor 69th-minute penalty was saved, the winger pounced to bundle home his 10th of the season on the rebound.
Hamilton boss Billy Reid responded two minutes later by withdrawing Marco Paixao for Joel Thomas.
It was all Saints and Murdoch partly redeemed himself by getting fingertips to Jody Morris' low free-kick 16 minutes from time.
Davidson became the second player booked for a foul on Flavio Paixao before Gary Irvine replaced Millar for the closing stages.
A great burst forward from Wesolowski ended when the midfielder squared for the unmarked Thomas, who skied his first-time finish from 15 yards.
Wesolowski showed him the way six minutes from time after more good work from Imrie, who surged down the right and into the box before crossing for the Australian to tap the ball home.
Saints made their last change when Paul Sheerin came on for Samuel before Imrie and Wesolowski combined again - this time down the left - but the latter blazed over.
David Elebert replaced McLaughlin for the final two minutes and McInnes was sent to the stands in injury time as his frustration boiled over.