Substitute Cody Cooke scored a hat-trick as St Mirren did their bit by beating Dundee 3-2 at Dens Park – but it was not enough to spare Oran Kearney's side from the relegation play-offs.
The Buddies had to better Hamilton's result against St Johnstone to escape a two-game shoot-out with Dundee United next week.
But while they responded to goals from Cammy Kerr and Scott Wright with Cooke's treble to claim victory, Kearney's side did not receive the favour they were praying for from Tommy Wright's men as Accies won 2-0 to secure a sixth straight season of top-flight football.
The game was the already-relegated hosts last before they drop down to the Championship and also defender Darren O'Dea's final match as a professional ahead of his retirement this summer.
But the former Celtic and Republic of Ireland defender did not bow out the way he hoped as he was sent off just 19 minutes in for a last-man tug on Brad Lyons.
More than 2,000 fans brimming with belief made their way from Paisley to Tayside.
But their optimism took a hit inside 14 minutes as Kerr put the hosts ahead.
Paul McGowan exchanged passes with Kenny Miller on half-way before looking up and measuring a sublime ball into Kerr's path, with the Dens skipper firing into the roof of Vaclav Hladky's net.
To make matters worse the goal was accompanied by news from the CBD Hope Stadium that Accies had taken the lead.
The long-suffering home support took the opportunity to rub it in, telling the visitors they were "going down with the Dundee".
Saints responded as expected by upping the tempo. Stephen McGinn fired straight at Jack Hamilton while O'Dea cut out a Lyons' cross.
But by the 19th minute, O'Dea's time was up.
Whereas the Irishman was making his last appearance before retiring aged 32, 16-year-old Finlay Robertson was only at the very start of his career after being handed his debut by Dundee caretaker boss James McPake.
But the youngster did his team-mate no favours with a ferocious chest-height pass. O'Dea's control was awful and he was forced to drag back Brad Lyons as the Saints forward burst through on goal.
Saints huffed and puffed through the rest of the half before Kearney rolled the dice at the break by throwing on Cooke for Mateo Muzek.
The move paid off within seven minutes as the striker thudded home with a header from Paul McGinn's cross.
And for a moment Saints dared to dream their escape act was on when Cooke rolled home his second when Ryan Flynn's strike broke back to him off Ryan McGowan.
But no sooner had the travelling Paisley faithful leapt from their seats than news arrived from Lanarkshire that Hamilton had scored again.
Dundee found themselves down to nine men as Genseric Kusunga limped off with all three subs made but that did not stop Wright squaring the match up again on 73 minutes as he ran on to Ethan Robson's superb cross-field pass to stroke past Hladky.
But Cooke claimed the match ball moments later as his shot squirmed through keeper Hamilton's grasp into the net and Kearney will now have to hope his team have the momentum as they prepare for their do-or-die double-header with United.