MILWAUKEE (AP) -- The leadoff single to Ryan Braun was understandable. The two walks allowed by Mark Melancon that followed were unexpected.
By the time Khris Davis came up with the bases loaded with nobody out in the ninth, there was no more room for error for the Pittsburgh Pirates closer.
Davis hit a game-ending two-run single and the Milwaukee Brewers rallied off Melancon for a 4-3 win Thursday.
"He's a human being and just didn't have his best stuff today. The walks are uncharacteristic," manager Clint Hurdle said. "He's been here for a while, and that's something we haven't seen."
Davis' broken-bat hit into short center drove in Braun and Jonathan Lucroy. Teammates showered Davis with a cup of water in the face in celebration.
Melancon (1-2) had given up just one walk in 19 previous appearances this season before Thursday.
"I just put myself in a bad spot," Melancon said.
The comeback spoiled the return of Pirates starter Wandy Rodriguez from the disabled list with right knee inflammation. Rodriguez allowed solo homers to Rickie Weeks and Martin Maldonado but struck out four in his first start since April 19.
Gaby Sanchez's solo homer off Yovani Gallardo in the sixth snapped a 2-2 tie to give the Pirates the lead until Davis' clutch single. Subbing for injured closer Jason Grilli, Melancon had converted his four previous save opportunities.
"I was just looking around and all of a sudden my teammates were running at me," Davis said about the postgame celebration and impromptu shower. "I just took it with a good smile, glad I could help win."
Left-handers Justin Wilson and Tony Watson combined for six strikeouts in three scoreless innings of relief before Melancon's meltdown.
They nearly pulled out a win for Rodriguez, who fared much better Thursday than during two rehab starts in the minors. The veteran left-handed posted a 10.38 ERA with Double-A Altoona.
"We had a very competitive start from Wandy, you can't overlook that," Hurdle said. "Confidence improved over time out there."
Rodriguez gave Hurdle a few worrisome moments, like when Rickie Weeks and Jean Segura led off the bottom of the first with two hits. But Rodriguez snared a hard bouncer up the middle from Braun to start a 1-6-3 double play to help him get out of jam.
Weeks homered the other way into the right-field corner off a 2-1 slider from Rodriguez in the third to extend the second baseman's hitting streak to eight. He finished 3 for 4.
"I don't pay attention to my speed. I pay more attention to how I located the ball," Rodriguez said. "I only made two mistakes today."
Facing the short-handed Brewers without Carlos Gomez helped, too. Milwaukee went a second day without its star center fielder, who is nursing a sore back while serving a three-game suspension for his role in a benches-clearing brawl between the teams April 20 in Pittsburgh. The Brewers are also without usual cleanup hitter Aramis Ramirez, on the disabled list with a pulled hamstring.
Rob Wooten (1-1) tossed 1-1/3 innings of scoreless relief, while Gallardo allowed five hits, three runs and struck out six in 6 1-3 innings.
Gallardo "did a nice job," manager Ron Roenicke said. "He made one mistake on a high slider, but I thought he threw well. He kept us in there, and we scratched."
Tony Sanchez added a two-run homer in the fifth, his first of the year for Pittsburgh. Sanchez sent a hanging 0-2 slider from Gallardo into the back of the Pirates bullpen beyond right.