Orioles manager Buck Showalter said he thought maybe the Brewers would use another pitcher to hit because Gallardo was scheduled to start Wednesday's series finale.

"We were well aware that Gallardo is one of their better hitters," Showalter said. "There are some decent hitting pitchers over here, we knew that coming in. I was hoping (Gallardo) had gone home to get ready for tomorrow. We knew he was over there."

After the walk to Reynolds, who earlier had hit his team-leading 12th home run, Brewers manager Ron Roenicke considered sending up another starting pitcher, Wily Peralta, to bat for reliever Francisco Rodriguez (2-1), but thought the best option was Gallardo, who was 1 for 14 this season.

"The only thing was Wily has tremendous power," Roenicke said. "With a guy on first base, you're hoping to get something lucky. Yo has shown over the years that he's really a good hitter."

Gallardo, who stepped to the plate with a career batting average of .202 with 12 home runs and 41 RBIs over eight seasons, drove a 2-0 pitch from T.J. McFarland (0-1) to deep center field for his first career pinch hit to win it.

The Orioles overcame an early 5-0 deficit to take a 6-5 lead, but saw the Brewers tie it at 6 with two outs in the ninth on an infield single by Jonathan Lucroy.

Lyle Overbay singled to open the ninth off reliever Zach Britton and Jean Segura sacrificed pinch-runner Elian Herrera to second. Ryan Braun's groundout sent Herrera to third, and he scored when Lucroy hit a chopper and barely beat third baseman Manny Machado's throw to first.

"The right pitch. The right execution. Just an unlucky bounce," Britton said. "If Manny can't make that play, there is nobody that can make that play."

The Orioles took a 6-5 lead in the seventh on pinch-hitter Steve Pearce's three-run homer.

Nelson Cruz hit his major league-leading 17th homer in the Baltimore fifth. He walked to open the seventh, and an error by Segura on his flip from shortstop set up Pearce's homer off Matt Garza.

"We had the lead. We had the pitching staff that we wanted to go in the ninth inning," Pearce said. "Some outs didn't go our way. It is baseball. It happens."

The Brewers, who blew a 6-4 lead in the ninth inning on Monday and lost to the Orioles in the 10th, powered their way to an early lead.

Carlos Gomez hit a three-run homer and solo shots by Reynolds and Khris Davis, all off starter Wei-Yin Chen, made it 5-0 through the fourth.

"For those two home runs, the first one I tried to get a strike but unfortunately I made a mistake," Chen said through a translator. "The pitch was a little up. The second was also a mistake. I tried to locate it somewhere else, but the location was hitter's strength so they hit it well."

NOTES: Brewers 3B Aramis Ramirez, on the DL since May 13 with a left hamstring injury, fielded grounders before the game. "It felt good. I took like 20-25 groundballs," he said. "I am going to take it day by day and when I am ready, I am ready." ... Gomez extended his hitting streak to eight games. ... Lucroy doubled in the eighth to extend his hitting streak to nine games, the Brewers' longest this season. ... Before the game, the Orioles activated 1B Chris Davis from the paternity list and optioned C Steve Clevenger to Triple-A Norfolk. Davis went 0 for 4.