Williams was unmarked, just six yards from goal, to head in Ross Barkley’s 85th minute corner after Alexis Sanchez’s 12th league goal of the season had been cancelled out by Ireland right-back Coleman.
“I don’t think with five to go we deserved to lose the game but we were caught on two headers,” Arsenal boss Arsene Wenger said.
“We put everything in and the players are very disappointed.”
Coleman rose to head a superb equaliser a minute before the interval, derailing, temporarily at least, Arsenal’s hopes of ending the year at the top of the Premier League.
The high stakes on offer at Goodison were summed up by players squaring up in the tunnel at the half-time whistle and Phil Jagielka receiving a 93rd minute red card for a second bookable offence ahead of a frantic finale.
Arsenal sent goalkeeper Petr Cech into the Everton area and the home defence blocked two shots as the clock ran out on their hopes of rescuing a point.
The equaliser had shown a rare lapse of concentration in the Arsenal defence as left-back Leighton Baines was given space on the left wing and swung over a perfect cross.
Coleman, showing all the instincts of a natural goal poacher, was equally unguarded and rose powerfully inside the six-yard box to glance a perfect finish past the stranded Cech.
It was his third Everton goal of the season, a remarkable return for a full-time defender, and was no more than the Toffees deserved for their reponse to falling behind to a 19th minute opening goal from Arsenal.
Sanchez appeared to have given the Gunners a stranglehold on the game with his sixth goal in his last four games, moving joint-first with Diego Costa at the top of the Premier League scoring charts in the process on 12.
It came from a free-kick on the edge of the area which struck Williams, the huge deflection taking the ball past keeper Maarten Stekelnburg who could only help it into his net.
It was a goal which had been steadily building and which added to the gloom around an Everton team which is seeing its season in danger of falling apart.
Despite those troubles, and the early goal they would go on to concede, Romelu Lukaku was soon in action in the Arsenal box, winning a corner which was poorly hit by the recalled Ross Barkley and Williams could only flick behind at the near post.
Worryingly for Everton, as the half progressed their defence dropped deeper and deeper, inviting Arsenal’s talented playmakers higher up the field.
Sanchez almost picked out Theo Walcott in the box and Nacho Montreal worked his way to the by-line again and forced Williams into an important clearing header.
On 18 minutes, the pressure mounted with Jagielka tripping Coquelin inches outside the Everton penalty area which led to the opening goal and more problems for Koeman.
Aaron Lennon tried to breathe life into a subdued Goodison with a strong run into the middle of the park only to see his 20-yard shot blocked by Gabriel.
Lennon, starting just his third game of the season, was looking Everton’s best hope of gaining a foothold in the contest, darting into the area just after the half hour but only managing to shoot into Petr Cech’s side-netting.
Barkley showed strength and vision in the middle to send Lukaku away only for the striker to hurry his shot way over and the ball fell to Lennon from a later free-kick but he failed to hit the target as the ricochet came at him quickly.
The equaliser, and some increasingly strong tackling from both sides, led to the half-time flashpoint when the two sets of players exchanged angry words and shoves as they went down the Goodison tunnel.
Ozil appeared to be at the centre of the scuffle and was quickly in action again after the restart feeding Sanchez who chipped into the box for Walcott to head wide.
And Ozil could have restored his team’s lead on 54 minutes when he latched onto a pass from Sanchez, made from the left-hand by-line, but curled a shot well over from just inside the area.
Ozil was then almost played clean through on goal by Hector Bellerin but Stekelenburg was sharp to the danger and raced from his goal to smother the striker, earning a kick for his troubles.
Yet Everton were not lacking in confidence after their strong end to the first half and, just before the hour, Jagielka’s long ball was chested down by Lukaku and Barkley’s low shot flew just beyond the right-hand post.
A cross from Enner Valencia also caused momentary problems in the visiting defence when his cross took a deflection off Gabriel and forced Cech into action.
Lukaku was becoming more of a factor and a strong run, shaking off Gabriel down the left wing, ended with a shot into the side-netting before a brilliant, driven Barkley cross just proved to difficult for the Belgian to meet.
Then came Williams’ decisive late intervention.
Stekelenburg 6; Coleman 7, Jagielka 6, Williams 6, Baines 7; McCarthy 7 (Funes Mori 90), Gueye 7, Barkley 9; Lennon 8 (Mirallas 68, 7), Lukaku 7, Valencia 7 (Calvert-Lewin 79, 6).
Robles, Deulofeu, Cleverley, Holgate.
Cech 6; Bellerin 6, Gabriel 7, Koscielny 7, Monreal 7; Coquelin 7 (Perez 88), Xhaka 6; Walcott 6 (Giroud 71, 5), Ozil 7, Oxlade-Chamberlain 6 (Iwobi 71, 6); Sanchez 8.
Ospina, Gibbs, Holding, Elneny.
M Clattenburg 7