The key shot with 9.7 seconds left gave the Pistons the cushion they would need as the Bucks' Brandon Jennings missed a potential score-tying trey with 3 seconds left.
Rodney Stuckey iced the victory with two free throws, securing Detroit's second consecutive win.
Jose Calderon provided 23 points, Stuckey finished with 19 and Villanueva contributed 18 for the Pistons.
Jennings led Milwaukee with 26 points and seven assists.
Ersan Ilyasova (15 points, 10 rebounds) and Samuel Dalembert (14, 12) also had good games but couldn't prevent the Bucks' third straight defeat.