Mason Mills was 17-of-24 passing for 257 yards for the Toreros (7-3, 6-1 Pioneer Football League), who won their fifth consecutive game.
Ferguson, who was subbing for starter Dallas Kessman (out due to illness), scored the game-winner on a 13-yard run.
Davidson (2-9, 2-6) tied the score at 10-10 with 4:37 on the clock when Robert Schick kicked a 22-yard field goal.
Colby Everett gave Davidson a 7-0 lead on a 1-yard touchdown run in the first quarter.
The Wildcats' Jonathan Carkuff was 23-of-37 passing for 250 yards, but he threw two interceptions.
San Diego plays Marist on Dec. 1 with a chance to tie Butler (8-3, 7-1) for the conference title.