Hamilton ensured they will not face a Ladbrokes Scottish Premiership play-off with a vital 1-0 win over Dundee at Dens Park.
Martin Canning’s side secured victory thanks to Carlton Morris’ eighth minute winner which moved them seven points above second-bottom Kilmarnock with two games left.
It could have been a bit more relaxed for the Lanarkshire club had Eamonn Brophy’s 47th minute strike counted, but it was knocked off for offside having previously been awarded.
However, it was the three points which mattered most and Accies can rest assured they will play their football in the top flight next season.
Dundee had been buoyed by their last-gasp 2-1 win over Dundee United which had relegated their city rivals on Monday night.
Hamilton began the game four points ahead of second-bottom Kilmarnock as they sought to drag themselves away from the prospect of being involved in the dreaded play-offs come the end of the season and they got off to a dream start after just eight minutes.
Dundee defender Kostadin Gadzhalov was caught out by Ziggy Gordon’s pass and Morris ran through and steadied himself before sending a left-foot shot across Scott Bain and into the corner of the net.
The hosts had a chance to equalise after 20 minutes when full-back Paul McGinn crossed from the right for Kane Hemmings whose header sailed over Michael McGovern’s bar, despite being well placed to score.
A minute later Nick Ross missed a sitter to bring the home team level.
A slick move ended with Craig Wighton feeding Hemmings who then squared for Ross, only for the former Inverness midfielder to shoot wide from six yards with just McGovern to beat.
Hamilton threatened to increase their lead when Ali Crawford’s corner was met at the far post by Michael Devlin but his header went narrowly wide of the target.
The second half was only two minutes old when Hamilton thought they had gone further ahead.
Brophy got in behind the Dundee defence and forced a shot under Bain and as he wheeled away to celebrate the hosts returned the ball to the centre spot.
But there were claims for offside and assistant referee Graham Chambers intervened.
Following a long consultation referee Steven McLean disallowed the effort with Brophy adjudged to have been offside, much to the visitors’ annoyance.
Hamilton had another chance to go 2-0 ahead with 65 minutes gone.
Gramoz Kurtaj’s inswinging cross was met by Dougie Imrie but, under no pressure from the Dundee defence, he nodded straight at Bain who saved at the expense of a corner.
Dundee were not out of it though and with 11 minutes remaining Hemmings went on a solo run before unleashing a 20-yard shot which McGovern tipped over the bar.
It was a nervy ending for Hamilton who had to endure five minutes of stoppage time but it was all worthwhile in the end as their safety was secured, even with substitute Greg Docherty missing a chance to double their lead when clean through on goal right at the finish.