Tony Andreu's late penalty consigned Dundee to relegation and put Hamilton firmly in the driving seat to avoid a play-off.
The hosts looked like they might at least delay the inevitable drop after Motherwell took the lead against St Mirren but a controversial spot-kick award from referee Nick Walsh allowed Andreu to net the only goal in the 83rd minute.
Ryan McGowan appeared to get the ball as he slid in on Hamilton substitute Mickel Miller but Walsh thought otherwise. There were surprisingly few complaints from the home side but there was an air of resignation around Dens Park even before kick-off.
The game only came to life after the break but the visitors created the better chances in both halves and their victory took them four points clear of St Mirren, who levelled with the last kick of the ball at Fir Park.
It was a 10th consecutive defeat for Dundee and manager Jim McIntyre had to endure chants of "You're getting sacked in the morning" from his own fans.
With their plight increasingly desperate, McIntyre employed an unusual formation which looked a 3-3-3-1.
But they made a poor start and Hamilton had already produced a couple of weak efforts before home goalkeeper Seny Dieng exacerbated the tension around the ground.
Firstly, his poor clearance went straight to Andreu 40 yards out, but the Frenchman was well off target with his effort. Then the goalkeeper came well off his line and got nowhere near Scott McMann's free-kick but he was again handed a reprieve as Marios Ogklmpoe's header drifted wide.
Dundee improved slightly and Scott Wright got their first effort on target, but Ryan Fulton was comfortably behind it. Cammy Kerr was not far away from long range for the home side but Hamilton had the best chance of the half when Andreu's flick sent Darian MacKinnon through. Dieng atoned for his early errors by coming off his line to block.
McIntyre made a change at half-time, bringing on striker Craig Curran for centre-back Genseric Kusunga and switching to a 4-4-2.
There was an added urgency to Dundee's play and John O'Sullivan threatened with a header, but Accies then created two better chances. Aaron McGowan's header was cleared off the line by James Horsfield and Dieng then had to get down quickly to save from Andreu.
McIntyre came under fire from the home fans after taking off striker Andrew Nelson in a straight swap for Kenny Miller.
News of Motherwell's opener lifted the visiting fans in particular and Scott Martin got them out of their seats with a curling long-range effort which went narrowly wide.
Dieng produced a decent stop from George Oakley but Andreu sent him the wrong way from the spot and Miller soon forced another save.
Darren O'Dea had a shot saved and Miller shot well over but St Mirren's equaliser would have made a Dundee goal academic.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Gavin McCafferty, Press Association Sport');
ga('pacontentapi.set', 'dimension2', '29a8b8e5-c722-4c35-b4aa-8c1aa50eb26f');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Dundee relegation confirmed by late Andreu penalty'});