Williams slotted the ball low past Fleetwood goalkeeper Scott Davies in the second minute of injury time having moments before been brought down by Youl Mawene inside the visitors' box.
Jake Reed had earlier hit the woodwork for the home side - taking advantage of a mistake by the out-of-sorts Mawene.
The Cod Army's best opportunities came in the early stages, Junior Brown unable to get on the end of a Barry Nicholson cross and then Nicholson sending David Ball through for the striker to fire wide.
The away side dominated after the break but failed to create any clear-cut openings. Brown could not connect at the back post following a testing cross from Tom Barkhuizen.
Then Barkhuizen struggled to turn having been sent into the box by Brown. But Williams' late penalty was enough to condemn Micky Mellon's side to their second consecutive defeat.