Neil McCann will live to fight another day as Dundee finally claimed their first win of the Ladbrokes Premiership season by beating Hamilton 2-0.
The Dens Park boss was clinging on to his job by his finger tips after seven straight defeats.
But goals from defender Andy Boyle and Karl Madianga at the Hope Stadium finally brought McCann’s run of woe to an end.
Dundee had not held a lead for a single minute in any game before Boyle’s first-half header but they were made to sweat on the result as Accies twice hit the bar in the second period.
But while they clung on for victory, it was not enough to move them off bottom spot and they remain a point behind St Mirren, with Martin Canning’s Hamilton staying put in ninth.
Just as they did before their latest defeat to Hibs last week, McCann’s team gathered for a pre-match huddle.
This time it had the desired effect as they came out unified in their determination to get a result.
Adil Nabi forced Gary Woods to palm over early on while it took a last-ditch Aaron McGowan block to deny barrel-chested frontman Benjamin Kallman burrowing into score.
With those openings going begging, Dundee could be forgiven for fearing they were in for yet another disappointment.
Their worst fears almost proved true when Accies defender Matt Kilgallon picked out Dougie Imrie’s run on the half-hour mark but McCann’s men breathed a sigh of relief when the veteran midfielder blazed his strike high.
For once Dundee refused to let their belief slip and even upped their tempo.
They got their reward seven minutes before the break as Calvin Miller’s deep free-kick found Boyle at the back post, with the Preston loanee powering home with his head.
While the jubilant travelling support cheered their side off at the break, Hamilton faced a chorus of boos as the Accies support showed their frustration.
Dundee should have doubled their lead on 53 minutes as the hosts switched off, allowing Miller to play a short corner to Spence. He slotted the ball back for Ryan Inness but the Crystal Palace loan defender fired straight at Woods.
Hamilton substitute Rakish Bingham came close with a free-kick but Scott McMann was lucky his throw-in blunder did not end in a goal as he chucked the ball straight to Kallman, with Nabi unable to take advantage.
With the clock ticking down and a long-awaited win within sight, Dundee naturally grew nervous and it almost cost them as Elliott Parish’s shaky punch landed at Steven Boyd’s feet but the Hamilton forward mishit his strike.
There was another let-off as Fredrik Brustad somehow failed to convert Bingham’s low cut-back from just three yards out.
The woodwork twice came to Dundee’s rescue as a James Keating free-kick and Bingham’s stoppage-time header both shook the crossbar.
But Madianga took the stress out of the matter when he fired home at the death after neat set-up play by Glen Kamara and Roarie Deacon.