Gallardo's single bounced over Chipper Jones at third base to drive in the only run Milwaukee needed off the previously unbeaten Hanson in the Brewers' 4-0 win over the Atlanta Braves on Saturday night.
With runners on the corners and one out in the fifth, Gallardo (9-7) squared to bunt on the first slider Hanson threw with no success before manager Ken Macha took off the sign.
"It was pretty exciting," Gallardo said after Macha's decision. "It was kind of hard to bunt that first pitch he threw me."
Instead, Gallardo, who scattered four hits in 7 1/3 scoreless innings, chopped the next pitch from Hanson over the drawn-in Jones to break open a scoreless game, giving the struggling Brewers a boost of confidence in a miserable July.
Milwaukee had lost 13 of 19 to fall from first to fourth in the NL Central, but Gallardo drove in the winning run for the third time this season after April homers were the difference against San Francisco's Randy Johnson and Pittsburgh's Ian Snell earlier this year.
"You always can help yourself out," Gallardo said. "I was trying to put the ball in play and hopefully hit a fly ball deep enough to score the guy from third. I wasn't planning on hitting one over Chipper's head."
Gallardo's recent performances matched the Brewers' slide and he said he tweaked his mechanics to keep from lunging forward off the mound after starting July 0-3 with a 5.09 ERA.
Hanson (5-1) came in looking for the best start by a Braves rookie since Larry McWilliams won his first seven decisions in 1978, and the duel between two of the NL's most promising young pitchers didn't disappoint.
Gallardo worked around runners in scoring position in the third, fourth and fifth innings by inducing grounders to get out of each jam. Brewers second baseman Felipe Lopez, acquired in a trade last week from Arizona, snagged the sharpest shot from Martin Prado to end the fifth instead of bringing Jones to the plate.
"Gallardo was outstanding. The guy pitched a great game. We had a couple of chances and that's all we got," Braves manager Bobby Cox said. "Prado hit a bullet right at Lopez. If that gets through, with Chipper and [Brian] McCann coming up, that was kind of the turning point for the offense."
Instead, the 23-year-old right-hander walked four and struck out six, leaving to a standing ovation in favor of Todd Coffey, who got the final two outs in the eighth.
Rookie Casey McGehee then drove in two insurance runs with a two-out, pinch-hit single in the bottom of the inning off Manny Acosta to make it 4-0 after Eric O'Flaherty was pulled when he walked the bases loaded with one out.
The 22-year-old Hanson lasted seven solid innings despite flulike symptoms.
Hanson, who gave up seven runs in his June 7 debut against the Brewers in a no-decision, said he'd lost 12 pounds this week because a severely sore throat limited him from eating. Tests were negative for strep throat and mononucleosis.
"He lost a lot of weight, but I think he was strong," Cox said. "He's tough. He's not a quitter."
"We planned on bunting the ball to third base. They were alerted to that," Macha said. "The second pitch, I let him go ahead and swing. For us, against that guy who'd been pitching extremely well, that was a big breakthrough."
Lopez then singled to load the bases and Hanson's only play on Craig Counsell's dribbler was to first, which scored Hardy to make it 2-0. That proved to be enough for Gallardo and the bullpen.
"It happens all the time," Hanson said of the two plays that turned into the only runs he allowed off nine hits and two walks. "You would like for it not to go that way, but it did. You just have to deal with it and keep moving forward."
Plate umpire C.B. Bucknor received attention from Brewers trainer Roger Caplinger after taking a liner off his face mask on Gallardo's foul tip in the seventh, but stayed in the game. Gallardo followed with a single. ... Brewers RHP Seth McClung (elbow) was placed on the 15-day DL just before the game. RHP Tim Dillard was called up from Triple-A Nashville. ... The teams wore uniforms honoring Negro League teams from their respective cities -- the Atlanta Black Crackers (1919-52) and the Milwaukee Bears (1923).