The Pistons ended a seven-game losing streak, winning for the first time since Jan. 21 against Portland.
Detroit led by as many as 19 points late in the third period but the Bucks closed to within four with 2:21 remaining on a layup by Shaun Livingston.
Knight then scored on his own layup and Milwaukee did not produce another point until just 11 seconds remained in the game.
Greg Monroe chipped in 18 points for the Pistons, who held Milwaukee to 35 percent shooting. The Bucks made only 3-of-17 from 3-point range.
Brandon Jennings had 20 points for the Bucks, who were coming off a win over Miami Wednesday.
Detroit was playing its first game at home after an 0-4 road trip.