Kris Boyd levelled matters in the second half after former Killie player Harkins had given the visitors the lead but Harkins doubled his tally 13 minutes from time to keep alive their slim hopes of remaining in the SPL.
Victory for Kilmarnock would have seen them in the top half of the table after the split but they finish in seventh place after results elsewhere went against them.
Kenny Shiels' side were denied early on, with Boyd's effort saved by Steve Simonsen after he had connected with a Garry Hay corner.
But it was the visitors who took the lead through the impressive Harkins, who latched onto the cut-back from John Baird before confidently side-footing home (6).
Harkins then had a decent penalty appeal turned down after he appeared to have been fouled in the area by Momo Sissoko but referee Iain Brines waved away the protests.
Harkins continued to threaten but he spurned the chance to double the lead as he headed over unmarked after getting on the end of Brian Easton's cross.
Kilmarnock threatened sporadically but Boyd continued to cause problems, with the former Rangers striker twice missing out at the other end.
Dundee continued to press after the restart, with Baird heading wide from close range before putting the ball in the back of the net, but the 'goal' was disallowed for a foul.
The home side struggled for creativity but they equalised on 74 through Boyd, who controlled the ball on his thigh before drilling past Simonsen.
But the joy was shortlived for Killie as Harkins grabbed his second of the afternoon with a powerful half-volley past Cammy Bell just three minutes later after Lewis Toshney had picked him out.
The home side still had the opportunity to draw level but Simonsen kept out a diving header from substitute Rabiu Ibrahim late on.