Williams ran for 88 yards on 19 carries. His 2-yard scoring run with 17 seconds remaining came with Samford trailing, 17-13. Michael Eubank threw for 228 yards and a touchdown for the Bulldogs (7-3, 5-2 Southern Conference).
Eubank found Tony Philpot on a 31-yard scoring strike to give Samford a 7-0 lead that would take them into the break.
The Citadel (4-7, 2-4) scored late in the third quarter on a short run by quarterback Aaron Miller, and Erik Goins kicked a 30-yard field goal early in the fourth to put them up 10-7.
Samford's Krondis Larry scored on a 14-yard run with 8:39 left in the fourth and the Bulldogs led 13-10.
Miller put The Citadel back up, 17-13, on a short TD run with 1:47 to play before Williams' winning score.