The visitors dominated the first half and it was no surprise when Sam Saunders gave them a 21st-minute lead. Their attacking play deserved it although there was an element of luck about the goal as a long-range free-kick from Saunders on the right-hand side took a deflection to leave goalkeeper Sam Walker flat-footed.
After a bad opening 45 minutes, Yeovil came out fighting and equalised in the 49th minute. Williams, with his back to goal on the edge of the box, turned neatly and beat goalkeeper Simon Moore with an exquisite shot into the top left-hand corner.
In the next few minutes Williams almost added two more to his tally, but with three minutes remaining he clinched Yeovil's fourth successive home victory.
Williams' 11th goal of the season was scrambled over the line when he shook off the attentions of two defenders.