The 1-0 loss ended a four-game winning run for the Dons, who had also won eight of their last nine, but Motherwell's defeat to Celtic meant they remained second.
The Dons made two changes from their home win over Hibernian a week previously, with captain Russell Anderson and Andrew Considine returning to the side.
Right-back Joe Shaughnessy and left-back Jonny Hayes dropped to the bench.
The visitors were without the injured Gary Warren and Ross Draper, but they were boosted by the return of midfielder Greg Tansey, who signed on for a second spell with the club after 18 months at Stevenage.
Tansey was on the bench, along with James Vincent, making his way back into contention following an injury.
But Hughes' men were swiftly on the back foot, with Aberdeen attacking from the off.
An early Barry Robson corner caused confusion in the Inverness area before goalkeeper Dean Brill took control of the situation,
After 10 minutes striker Scott Vernon headed Niall McGinn's cross wide and five minutes later a corner from Robson, who has already scored direct from such a set-piece this season, narrowly cleared the bar.
The home side were in the ascendancy and it took a block from the well-placed Carl Tremarco to deny Mark Reynolds as he connected with Considine's cross from the left.
For all their possession and willingness to get forward, Aberdeen were struggling to seriously test Brill and their lack of cutting edge was punished midway through the first half.
On a rare foray into Dons territory, Aaron Doran's cross from the right found Williams in space at the back post and he blasted home off the underside of the bar.
Liam Polworth became the first man booked by referee Iain Brines for a cynical trip on Considine and he was followed into the book by Tremarco, who was perhaps harshly penalised for a high challenge on Robson.
The goal had settled the visitors and they had another couple of opportunities.
Towards the end of the first half Williams' cross flashed across the face of goal, crying out for a touch to turn it home, while the midfielder himself was denied by Langfield.
Caley Thistle picked up in the second half where they had left off in the first.
Billy McKay had been quiet in the first half, but he had an eight-yard shot blocked and then raced forward on the counter-attack, with only a muscular challenge from Anderson shutting him out.
Aberdeen boss Derek McInnes reshuffled his pack just before the hour, with Shaughnessy and Hayes entering the fray in place of Robson and on-loan Swansea man Alan Tate.
The final Dons replacement came with 25 minutes left, with Josh Magennis replacing the ineffectual Vernon in attack.
Hughes also looked to his bench at this point, Tansey replacing Doran.
However the game was much more even now, with Inverness looking particularly strong in defence.
They stood up to everything Aberdeen could muster, although Willo Flood nearly broke through with a looping effort from 15 yards, but Brill pushed it over.
Aberdeen became increasingly desperate in their bid for a goal and were almost caught out at the other end.
Graeme Shinnie's challenge caught Flood unawares, and after exchanging passes with McKay, he fired in a shot, only to see his effort come back off the bar.
It was a let off for the hosts, but Hughes' men still held on for a deserved win.