MILWAUKEE -- Khris Davis' bat splintered after making solid contact with the pitch and he started running. He didn't know where the ball landed, but suddenly his fellow Milwaukee Brewers were rushing him at first base.
He got doused with a celebratory cup of water and quickly figured out what happened.
''I was just looking around and all of a sudden my teammates were running at me,'' the second-year left fielder said about the postgame celebration and impromptu shower. ''I just took it with a good smile, glad I could help win.''
A nine-game homestand ended on a high note for the surprising Brewers, who maintained their five-game lead over St. Louis in the NL Central and got their fourth win in five games.
It was a big confidence boost especially for Davis, a young slugger who struggled the last few weeks but has showed signs of breaking out of his slump. His average had dipped to .212 before going 4 for 9 in three games against the Pirates.
Does this make him ''Klutch'' Davis?
''I'm not big on nicknames, but it sounds good,'' Davis said with a laugh. ''Why not?''
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 Melancon (1-2) broke down in the ninth. Subbing for injured closer Jason Grilli, Melancon had converted his four previous save opportunities.
Ryan Braun led off the ninth by singling. Melancon walked the next two hitters to load the bases with nobody out.
''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.''
Up came Davis, who smashed his broken-bat hit to drive in Braun and Jonathan Lucroy. Melancon had given up just one walk in 19 previous appearances this season before Thursday's meltdown.
''I just put myself in a bad spot,'' Melancon said.
The Pirates nearly came through with 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.
''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.''
Weeks homered the other way into the right-field corner off a 2-1 slider in the third to extend the second baseman's hitting streak to eight. He finished 3 for 4.
Rodriguez entered with a 7.65 ERA, while Melancon had a 1.42 ERA. In the end, the Brewers ended up having more success against the closer.
Reliever Rob Wooten (1-1) threw 1 1/3 scoreless innings. Gallardo allowed five hits, three runs and two walks, 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.''
The short-handed Brewers went a second day without star outfielder Carlos Gomez, 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 Pirates' Tony Sanchez had a two-run homer in the fifth, his first of the year.
The Brewers announced that Premier League team Swansea and Mexican club Chivas would meet July 16 for the first professional soccer match at Miller Park. ... Roenicke said Gomez was feeling much better Thursday. Gomez left Tuesday's game with the injury, and his dropped his appeal of the suspension the next day. Gomez is eligible to return Saturday against the Cubs. ... Milwaukee opens the three-game set Friday in Chicago with starter Kyle Lohse (4-1). The Pirates start Edinson Volquez (1-3) to open a series Friday in New York against the Yankees.