Terry Butcher's side emerged at Dens Park keen to bounce back from their first defeat of the campaign against Aberdeen at the weekend and McKay set the tone early on sending a shot just over the bar. The match was only nine minutes old, though, when the breakthrough came.
The visitors worked the ball well down the left side and Richie Foran gave himself a shooting chance following a one-two with Nick Ross.
The captain sliced his shot but the ball fell kindly for McKay eight yards out and the Northern Ireland internationalist reacted quickly to knock the ball home.
Both Ross and McKay went on to hit the frame of the goal but Dundee improved considerably after the halfway stage. However, Inverness goalkeeper Dean Brill saved well from Craig Beattie and Peter MacDonald before making a superb 89th-minute stop from Ryan Conroy to send the SPFL Premiership leaders through.
"The players have got to buy Dean Brill a big drink because he has kept us in the cup," said Butcher. "The team that turned up tonight is not the team that got us to the top of the league and the players have been told that in no uncertain terms."
Inverness, who had Danny Devine in for the injured Gary Warren, kept pushing forward after the opener and McKay saw a shot deflected over before Ross blazed over from 18 yards.
Butcher's side, who were one of last season's beaten semi-finalists, came close to a second in the 20th minute when Foran sent Ross down the inside right channel with the outside of his boot. The wide player held off a challenge and stabbed the ball past Kyle Letheren but could only watch as it bounced off the post.
Jim McAlister and Beattie had shots deflected wide as Dundee tried to force their way back into the game but Inverness were closing them down quickly and continued to possess a goal threat when they went forward. Dundee forced Brill into his first save with the last kick of the first half, when the ball fell for Beattie 16 yards out following a quick break. The former Celtic striker drilled a left-footed shot which Brill stopped with an excellent diving save.
John Brown's men continued to pin Inverness back but they struggled to break down a resilient defence which has now kept five clean sheets in eight games this season. Ross came close with a late curler but it wasn't to be for the home side.
Brill secured the victory when he dived low to his left to keep out Conroy's shot after a MacDonald backheel had set up a chance just inside the box. "We need to take our chances," said a disappointed Brown afterwards. "That has let us down this season but tonight they had a goalkeeper that was unplayable."