McKay's second, in the 82nd minute, earned Caley victory at the expense of Aberdeen, for whom Josh Magennis also scored twice.
McKay had earlier given his side the lead but they had to come from behind at Pittodrie after Magennis struck twice in five minutes.
The visitors took the lead after 36 minutes when captain Richie Foran won the ball from Jamie Masson in the midfield and allowed Andrew Shinnie to burst forward, spreading the ball to Aaron Doran on the right. He crossed low and McKay steered home from close range.
The home crowd was incensed by referee Alan Muir's refusal to give a free-kick for what they saw as a foul by Foran and made their feelings known to the match official, but the decision was made and the visitors led.
Their mood was cheered in injury time, however, when Magennis turned home the equaliser from close range after a low Hayes shot had deflected into his path.
The yellow card he picked up for his celebration was met with further jeers towards the referee - who did not re-emerge for the second half, leading to a delay of 10 minutes while an extra official was found from the crowd.
A change of tactics for the hosts saw Magennis moved up front and it proved a masterstroke as he put his side in front just five minutes after the restart.
He rolled Josh Meekings with his first touch from a Niall McGinn pass and, left with just Antonio Reguero to beat, he prodded the ball beyond the Spaniard and into the corner of the net.
But the lead was short-lived as the Caley Jags drew level eight minutes later. The Dons switched off from a Doran corner and Gary Warren rose to head beyond Langfield from six yards.
Boosted by their goal, the visitors became a real threat and threw caution to the wind, with four men up front at times.
But Inverness deservedly went back in front with eight minutes left when the predatory McKay found the net for a second time, easing the ball past Langfield after a rare error from Dons skipper Russell Anderson.