PITTSBURGH -- Pirates pitcher Kip Wells has not had many nights to remember this season. Leading the major leagues in losses will have that effect.
"Obviously at this point in the season it was a goal of mine to go out there and try to have a quality outing and finish on a good note," Wells said.
"It's just a little bit of peace of mind at least heading into the offseason that I finished on a good outing, because the season as a whole has been disappointing."
Wells (8-18) pitched 6 2/3 innings and allowed only an unearned run in the first. He surrendered six hits and picked up his first win since an 11-2 victory at Philadelphia on Aug. 19. It was his first home victory since beating the Phillies 3-0 on July 5.
Wells avoided becoming the first Pirates starter in 20 years to lose 19 games. The last Pittsburgh player to lose that many games was Jose DeLeon, who went 2-19 for a Pirates team that finished 57-104.
"It's hard to watch when he's not on," Pirates interim manager Pete Mackanin said.
"When he's on it's really nice to watch because you can see the potential there and see what he's capable of doing and, I don't know if he was at his best, but it was close."
Wells dropped his season ERA from 5.29 to 5.09. He struck out four and walked only two before giving way to reliever John Grabow with two outs in the seventh.
"He got a lot of groundball double plays and he stayed away from the guys that could possibly hurt him," Milwaukee manager Ned Yost said. "He's seemed like he tries to get you to chase a little bit and tonight, he was locating real well."
Milwaukee's Tomo Ohka (11-9) allowed five runs and eight hits in 7 1/3 innings.
"One thing that Tomo was able to do was give the bullpen the night off," Yost said. "That helps."
Craig Wilson went 2-for-3 with a double and an RBI while Freddie Sanchez went 2-for-4 with two doubles and an RBI to extend his team-best hitting streak to 16 games.
Nate McLouth and J.J. Furmaniak also went 2-for-4 to generate offense for Wells, who came into the game with the lowest run support (3.08 per game) of any major-league starter.
Wells' performance means that Milwaukee (81-80) must win Sunday against Pirates rookie Zach Duke (7-2) to finish over .500 for the first time since 1992.
Milwaukee went ahead in the first when Rickie Weeks doubled and scored as Lyle Overbay's single to left rolled under Bay's glove for an error. Wilson hit an RBI double in the bottom half, and Bay's sacrifice fly in the fifth gave Pittsburgh the lead.
Sanchez added a run-scoring double in the seventh, and Pittsburgh scored twice in the eighth on McLouth's RBI double, which chased Ohka, and Furmaniak's run-scoring triple against Jose Capellan.
Milwaukee put runners at the corners with two outs in the seventh, but Grabow relieved and picked Weeks off first base. Mike Gonzalez and Salomon Torres finished the six-hitter.
"I just tried to take on the same approach as my previous outings," Wells said. "I was just trying to visualize the pitch that I wanted to throw and execute it."
Bay's 101 RBI are the most for the Pirates since Brian Giles had 103 in 2002. ... Wells is the second Pirates pitcher in three years to lead the NL in losses following Jeff D'Amico (9-16) in 2003.