In a meeting of last-place teams, the Brewers broke things open in the late innings and pushed the defending World Series champions closer to having the second-worst record in the National League.
With Milwaukee trailing by a run heading into the eighth, Khris Davis led off the inning with a single and went to third on a double by Yuniesky Betancourt. Jeff Bianchi then reached on an infield base hit that scored Davis with the tying run.
That brought up Schafer, whose bunt delivered Betancourt with the go-ahead score. Pitcher Madison Bumgarner threw wildly to first on the play, putting runners on second and third, and both of them scored on a single by Norichika Aoki.
Davis added a homer in the ninth and Martin Maldonado singled in another run later in the inning.
The late comeback gave the win to Alfredo Figaro (2-3), who gave up a run while working two relief innings. Bumgarner (11-7) allowed four runs on five hits in seven-plus innings to suffer the loss.