HOUSTON -- Make no mistake about it, things aren't pretty for the Houston Astros.
They have the worst record in baseball and are barreling toward their second straight 100-loss season.
But on Friday night this terrible team walked off the field winners after a dramatic ninth-inning rally for a 4-3 victory over the Milwaukee Brewers.
Brian Bogusevic's RBI single in the ninth inning capped the Astros' two-run rally.
It was the first win this season for Houston in its last at-bat and breaks a five-game losing streak. It was Houston's first walk-off win since last Sept. 26, according to STATS LLC.
"It was a good feeling. They're fun and when you wait this long for one it's really fun," Bogusevic said of walk-off wins. "It's been a long time since we've had some good things happen for us. We've played a lot of close games but haven't come out with wins."
The Astros won for the fifth time in 39 games. The only team since 1900 to lose at least 35 times in a 39-game span was the 1916 Philadelphia Athletics, who finished 36-117 under Hall of Fame manager Connie Mack, according to STATS.
Wilton Lopez (4-1) struck out two in a perfect ninth inning for the win.
Houston manager Brad Mills has talked day after day about wanting to see his team be rewarded for its improvement. He couldn't stop smiling after the National League's youngest team finally was.
"It was just good for them to get something for it," he said. "The coaches have been doing a great job of keeping the guys upbeat. The guys were just thrilled to death, and it's nice to see, no doubt."
The Brewers have lost 10 straight on the road for the first time since 1992.
Houston trailed 3-2 entering the ninth. Brett Wallace walked with no outs and was replaced by pinch runner Tyler Greene, who was making his Astros debut after being acquired in a trade with St. Louis on Thursday.
He stole second base and advanced to third on a wild pitch by John Axford (4-7), who was charged with his eighth blown save.
"I don't know if I'll keep using (Axford) there or not," Milwaukee manager Ron Roenicke said. "Maybe depending on the matchups, we'll give him a chance. We thought this was a good opportunity to get him in there and get him back to the guy that we know he is."
Steve Pearce's RBI single to center tied it at 3.
"You could tell something good was going to happen," Pearce said of Houston's momentum growing in the ninth. "You could see the body language of the pitcher, the crowd, and you could feel it coming."
Pearce advanced to second on the play on an error by centerfielder Carlos Gomez.
Gomez made up for his miscue when he made a running, over-the-shoulder catch on a long fly ball to deep center by Scott Moore.
Bogusevic followed with a hard-hit grounder to center to give Houston the win and send the Astros spilling onto the field for a rare celebration in this dreadful season. The players dashed to mob Bogusevic, who tried unsuccessfully to get away from the pack, sending the party into the outfield.
"It was a really good inning, everybody did their job," Bogusevic said. "It was a bunch of things that needed to be executed that were all executed, which was really good to see because it hasn't always been that way."
Indeed. Houston has struggled to get the key hit or pitch to close out close games this season. The Astros are 0-11 in extra-inning games and have 22 one-run losses.
Rickie Weeks had a career-high three doubles for the Brewers.
Houston's comeback win ruined a good night for Milwaukee starter Mark Rogers. He didn't allow a hit until the fifth inning and gave up three hits -- all singles -- with one run in a career-long seven innings. Rogers, who replaced Zack Greinke in the rotation, struck out a career-high eight with two walks.
Carlos Corporan drove in Houston's first run with a single in the fifth inning and added a solo homer in the eighth.
Houston starter Bud Norris yielded eight hits and three runs -- two earned -- in seven innings but didn't factor in the decision to end his winless streak. Norris hasn't won since May 21.
Ryan Braun's double gave Milwaukee a 1-0 lead.
Weeks doubled in the second, fourth and seventh innings. Each of the hits landed in almost the same spot in the corner of left field.
Houston's first hit came with one out in the fifth on a bunt single by Scott Moore which dribbled down the left field line.
Weeks opened the seventh with his third double and scored on a single by Jean Segura to put Milwaukee ahead 3-1.
Houston recalled OF Fernando Martinez from Triple-A Oklahoma City on Friday. ... Milwaukee RHP Shaun Marcum, on the 60-day DL with right elbow tightness, is on a rehabilitation assignment with Single-A Wisconsin.