PITTSBURGH -- After building big leads in their previous three games only to lose each time, the Houston Astros didn't let it happen again.
Geoff Blum hit a three-run homer in the first inning and Houston avoided a three-game sweep by holding off the Pittsburgh Pirates 6-4 Wednesday.
Kazuo Matsui, Ty Wigginton and Michael Bourn each had two hits for the Astros, who blew a four-run lead before scoring twice in the seventh.
The Astros had early 3-0 leads Monday and Tuesday against Pittsburgh. They also lost in 17 innings Sunday at Atlanta after holding a 5-1 cushion at one point.
"I think that win was pretty necessary considering the way things have been going with the 17-inning game, the rain delays and 5-hour losses and things like that," Blum said. "It's good to get out of here with a win."
Last-place Houston, which had lost seven of eight, is one game behind the Pirates in the NL Central. Tuesday's loss included more than three hours of rain delays and didn't end until after 1 a.m.
"It's definitely a good feeling to finally get a win here," Astros manager Cecil Cooper said. "We played awfully hard these last three days."
Nate McLouth had three doubles and scored twice for Pittsburgh, which has dropped four of six.
The go-ahead run came without a ball leaving the infield. Bourn reached on a bunt single against Sean Burnett (0-1) and was sacrificed to second by Brad Ausmus. Pinch-hitter Mark Loretta chopped a ball just in front of home plate, and Pirates catcher Ryan Doumit threw to third too late to get the speedy Bourn.
Hunter Pence followed with an RBI groundout before Matsui hit a double to center that drove in Loretta to give the Astros a two-run lead.
"We did a good job of manufacturing something in that two runs in the seventh inning," Cooper said. "I think that's what you have to do. Good clubs do that."
Houston starter Brian Moehler (5-4) was the beneficiary of that rally. He earned the win after allowing four runs, seven hits and a walk in six innings. Jose Valverde pitched a scoreless ninth for his 23rd save.
"We were lucky to score some runs in the seventh inning and our bullpen came in and did a great job," Moehler said.
The Astros jumped out early against John Van Benschoten, who is 2-12 with an 8.96 ERA in his career and was optioned to Triple-A Indianapolis after the game.
Van Benschoten retired his first two batters but allowed the next six to reach. He walked Lance Berkman and Carlos Lee before Blum drove the first pitch he saw to right for his sixth homer. Three singles later, it was 4-0. Van Benschoten struck out Moehler to complete a 35-pitch inning.
The former first-round pick didn't allow another run -- but he did yield eight more base runners in his remaining 3 2/3 innings. Van Benschoten's final line: four runs on seven hits and six walks with six strikeouts. He threw 117 pitches.
"He was OK," manager John Russell said. "Obviously, the first inning wasn't very good for him, but he put up zeros after that."
Van Benschoten hadn't been notified of his demotion to the minors when he met with reporters after the game.
"You shouldn't feel that added pressure," he said of his plight to keep his spot in the rotation, "but I definitely need to come with it a little better than that, obviously."
The Pirates made it 4-1 when Xavier Nady tripled leading off the second and scored on Adam LaRoche's groundout.
Pittsburgh added two more with two outs in the third on Doumit's RBI single and Jason Bay's run-scoring double.
The Pirates tied it at 4 in the fifth on Freddy Sanchez's sacrifice fly.
"We fought back and tied the game. I thought we were right there," Russell said. "We still had opportunities. We thought things were really going our way, and then we give up two runs and just like that, it took a little wind out of our sails."
The Pirates said a corresponding roster move for Van Benschoten wouldn't be announced until Thursday. ... The previous time a Pirates player had three doubles in a game was Nady in Chicago on Aug. 4, 2006. ... The Pirates haven't won three in a row since a season-high six-game streak May 6-12. ... Lee went 0-for-2 with three walks, ending his 11-game hitting streak.