The home side's new interim manager John Brown was all set to celebrate his second win at the helm in the space of just a few days thanks to John Baird's excellent first-half opener but Caley Thistle hit back through McKay's 82nd-minute header.
With just nine games now left, the Dark Blues remain 14 points behind second-bottom St Mirren but have showed again they are not about to give up the fight for survival yet.
It was the Highlanders who created the first clear-cut scoring opportunity.
Aaron Doran found some space wide on the left which allowed him to swing over a cross for McKay, whose back-post header flew wide of the target.
But in the 12th minute the fired-up hosts took the lead in some style.
Recalled Ryan Conroy laid the ball off to Baird who looked up and wasted no time in sending an unstoppable 20-yard shot low into Ryan Esson's left-hand corner.
It was Baird's third goal in as many SPL games as he continues his resurgence under Brown.
However, they had to rely on goalkeeper Rab Douglas to stay in front as he smartly parried Graeme Shinnie's left-foot effort before Brian Easton swept the rebound clear to breathe a sigh of relief.
They suffered another scare in the 20 minute when Graeme Shinnie's corner was met by Gary Warren, whose header looked goal-bound.
But Dundee defender Gary Irvine managed to nod his effort off the bar before Iain Davidson headed the danger clear.
Easton became the first player to be booked after 24 minutes for hauling down Doran as he broke clear on the counter-attack.
Then, in the 27 minute, Birmingham-target Andrew Shinnie rattled the woodwork with stunning strike out of nowhere.
Shinnie picked up possession 25 yards from goal and had only one thing on his mind as he left fly only to see his shot come crashing back off the bar with Douglas beaten.
But in the 32nd minute Dundee had a golden opportunity to increase their lead.
Nicky Riley's cross was inch-perfect for Baird who made contact from close-range but Caley Thistle keeper Ryan Esson came flying out to thwart him.
Dundee began brightly after the interval with Conroy's corner being head flicked on at the near post by Iain Davidson, forcing Esson to tip over the bar.
Midway through the second-half, Riley threatened to race clear down the right only to be hauled down by Graeme Shinnie who was booked for his troubles.
At the other end, Douglas dived low to his left to push away Owain Tudor Jones' shot in the 75th minute.
Inverness pushed for an equaliser towards the end and just as Dundee looked like holding out, the visitors struck.
Graeme Shinnie's cross reached the far post where McKay rose to head home unchallenged from close range.
It was a sore one to take for Dundee but probably no less then the Highland outfit deserved.
- Sports & Recreation
- Caley Thistle
- Ryan Esson