When you play a game as strange — and ugly — as the Milwaukee Brewers did on Friday night, it's not often that you come out on top.

Yet, that was exactly what happened for the Brewers, who somehow overcame four errors in the field and a couple more on the base paths to outlast the Pittsburgh Pirates, 5-3, in front of 31,564 frustrated fans.

Throw in Martin Maldonado literally hitting the cover off the baseball in the sixth inning — a play that helped lead to a valuable insurance run — and it seemed as though the game was being played in the Twilight Zone rather than PNC Park.

"We were fortunate to win the game — especially the way we started out," manager Ron Roenicke said. "It was just one of those games. Goofy stuff happened early."

Indeed it did. But there were a number of players who helped turn the tables the Brewers' way as the night progressed.

There was starter Kyle Lohse, who improved to 3-1 with a gutsy 61/3-inning outing and kept his focus despite his defense going to pieces behind him.

There were Carlos Gomez and Scooter Gennett, who combined to drive in four of the five runs with key hits in the fourth, fifth and sixth innings.

There were relievers Tyler Thornburg, Will Smith, Jim Henderson and Francisco Rodriguez, who did yeoman's work behind Lohse.

And then there was Mark Reynolds, who made two nice defensive plays in succession to close the game in the ninth after committing one of those errors in embarrassing fashion in the first.

"It was an ugly, terribly played game," said Reynolds, who also had two hits and scored a run. "You have to credit Lohse for pitching around all of the crap we caused for him."

In the first, Lohse got leadoff hitter Starling Marte to sky a pop fly on the infield, only to see Reynolds and Aramis Ramirez collide as the ball dropped. Reynolds was charged with the error.

Marte quickly stole second, with Maldonado throwing the ball into center field for the second error, and then came in to score on a ground-out by Russell Martin.

In the third and with runners on first and third, Martin singled to center. The run scored, but Gomez overran it slightly, and Marte dug for third. His throw to third was cut off by Jean Segura, who himself bobbled the ball to allow Martin to advance to second when he would have otherwise been dead to rights.

Segura could have been charged with an error himself on the play — he would be in the seventh when he overthrew Reynolds at first — but wasn't.

Lohse then walked Andrew McCutchen to load the bases but got himself out of the jam by striking out Pedro Alvarez on a high fastball and getting Neil Walker to pop out to Ramirez at third.

Pittsburgh held that 2-0 lead until the fourth, when Milwaukee grabbed it back with a three-run rally.

Ryan Braun led off with a double to right, Ramirez walked and then Charlie Morton hit Khris Davis to load the bases. Reynolds flied out to left for the first out, but Gennett followed with a big double into the gap in right.

Braun and Ramirez came around to score, but Davis ran through Ed Sedar's stop sign at third base and was thrown out by 20 feet at home. Maldonado picked Davis up with a single to center that scored Gennett to put the Brewers in front, 3-2.

Milwaukee tacked on a run in both the fifth and sixth innings against Morton, both courtesy of Gomez. He led off the fifth with a towering 435-foot home run on a changeup to straightaway center, then in the sixth drove in Reynolds with an infield single that made it 5-2.