Williams scored the go-ahead basket on a layup with 15 seconds to go. On Ohio's following possession, Josh Mballa blocked Jason Preston's layup attempt with five seconds left. The Bobcats gathered the deflection, but a pass attempt to Sylvester Ogbonda was tipped by a Buffalo defender, ricocheted off Ogbonda's fingertips and went out of bounds.
Jayvon Graves made a pair of foul shots with 0.3 seconds to seal the win.
Davonta Jordan added 10 point for the Bulls (11-6, 2-2 Mid-American Conference). Buffalo has won two straight and five of its last seven.
Ben Vander Plas scored a career-high 28 points and Jason Preston tied a career-high 27 points for Ohio (9-8, 1-3). Ogbonda scored 12.
For more AP college basketball coverage: https://apnews.com/Collegebasketball and http://twitter.com/AP-Top25
The coronavirus and college sports: NCAA reopening plans, latest news, program cuts, more
When will college football and other sports return to action? Will more athletic programs be forced to cut sports because of financial strains? Here is the latest on how the coronavirus pandemic is affecting the college sports world.
Alabama shooting star John Petty Jr. will return for senior season
Alabama guard John Petty Jr. says he won't be entering the NBA draft and will be returning to school.
NCAA petitions Supreme Court on rulings that expanded benefits
The NCAA asked the U.S. Supreme Court to suspend federal court rulings that allow college athletes to receive an expanded number of education-related benefits.