Manager Neil McCann believed, rightly, that his players had deserved the victory and he was fulsome in his praise afterwards.
“There is no better feeling, even if you win handsomely, than scoring right at the death,” he said. “It deflates the opposition and you could see the wild celebrations. It was a brilliant finish from us and I thought we were relentless in that search for a winner.”
The home side broke the deadlock after just 90 seconds but, while it was one of the quickest goals of the season, it would not rank among the best.
A disputed free-kick led to the breakthrough – Jack Hendry was adjudged to have impeded Antonio Rojano when it looked a case of six of one and half-a-dozen of the other. Danny Redmond’s delivery was headed back across goal and Mark O’Hara, trying to clear, sliced the ball behind the static Elliot Parish.
Gary Woods helped Hamilton remain in front when he dived to his left to keep out Paul McGowan’s angled drive, while Danny Redmond and Lewis Ferguson were cautioned for fouls on McGowan and Kevin Holt respectively.
O’Hara was booked for bringing down Darren Lyon on the edge of the penalty area and David Templeton’s free-kick struck the inside of Parish’s right-hand post before spinning back into play. Holt was then shown a yellow card for a cynical kick at Antonio Rojano; it was that kind of game.
The visitors were handed a lifeline in the 74th minute when Templeton, already booked for a foul on Glen Kamara, had a petulant kick at substitute Scott Allan and was shown a second yellow.
It took Dundee just four minutes to make their numerical advantage count. Allan, whose arrival had done as much to transform their fortunes as Templeton’s dismissal, produced a sumptuous cross and Matthew Henvey prodded it home to claim his first senior goal.
Hamilton kept plugging away and almost benefited from another own goal but, on this occasion, Parish managed to keep out Holt’s header from Dougie Imrie’s free-kick.
Unfortunately for them, their hopes of holding out for a point receded when midfielder Darian MacKinnon was forced off with an injury. Having used all three substitutes, Accies were down to nine men.
Just when it seemed they had done enough to escape with a draw, Allan drew a foul on the right flank. The ball was worked to Kamara and his cross-shot was diverted behind Woods by A-Jay Leitch-Smith, sparking jubilation among the travelling support.
“Temps does something ridiculously stupid,” said Hamilton manager Martin Canning. “I talk to the boys all week about decision-making and that decision has cost us the game.”