Last updated on .From the section Scottish Premiership

Dundee finally earned their first Scottish Premiership points of the season by edging Hamilton Academical.

Andy Boyle headed in the opener from a Calvin Miller free-kick and Karl Madianga sealed the win in injury time.

The victory brings Dundee's seven-game losing streak to a halt and sends them to within a point of Motherwell and St Mirren, easing a little of the pressure on manager Neil McCann.

Hamilton hit the bar twice and Fredrik Brustad missed from point-blank range.

But despite the defeat, Martin Canning's side remain in ninth place with six points.

Dundee finally find killer touch

For weeks, Dundee have looked comfortable on the ball without threatening and there was a lot of that here, too - comfortable passing play, little penetration.

They were still painfully wasteful for long spells. Ryan Inniss and Adil Nabi squandered second-half chances at a time when McCann's men were firmly in the ascendancy, feeding off the confidence engendered by Boyle's opener.

The saving grace for Dundee was that Hamilton were equally profligate. Brustad's miss was spectacular, screwing a delicious Rakish Bingham cross wide inside the six-yard box.

Bingham himself bent a free-kick just off-target soon after, James Keatings cracked the crossbar with another set-piece, and Mason Bloomfield hit it again with a header in the dying minutes.

Dundee rocked, but held on to their clean sheet. And as Hamilton pressed in desperation, they struck the killer blow. Madianga took up a good position, and when the ball found him, he swept it into the net.

Bedlam at the Dundee end. Bedlam in the Dundee dugout. Bedlam, roaring and bear-hugs among the Dundee players on the park.

Karl Madianga's last-gasp goal killed the game

Can long-awaited win spark Dundee revival?

BBC Scotland's Jane Lewis at New Douglas Park

Beleaguered Dundee and their manager feel they are much better than their league position indicates. Might this be the start of a much-needed revival? In one game, they doubled their haul of league goals scored this season, and kept their first clean sheet of the campaign.

The challenge now is to take the jubilation this victory so clearly generated and turn it into the sort of form that can propel them up the table. That challenge is considerable, with their next four fixtures against top-six teams, including unbeaten league leaders Hearts and Celtic.

But it will feel an awful lot less daunting than it would have been had they fallen to another loss in Lanarkshire.

'It was a brilliant performance' - reaction

We've been punched so many times - McCann

Hamilton Academical manager Martin Canning: "I don't know how we never scored in the second half. We created so many opportunities, hit the bar twice.

"You've just got to keep your chin up and get on with it. We didn't get the break but the second-half performance was good. Had we got a goal we probably would have won. We were so dominant."

Dundee manager Neil McCann: "I'm really pleased, I thought it was a brilliant performance. They'd never been in that position, 1-0 up, and the deeper you get into the game, you've got to hold up.

"They stood up to so much. Hamilton brought on some bigger guys and went more direct but we held on and killed the game."