Jason Jaramillo singled home the winning run 4 win over the Houston game set.
Andrew McCutchen hit a three-run and solo home run for the Pirates, who have won four of six. Tony Watson (2-2) got the win for recording the final out of the eighth while Brian Burres gave up four runs on seven hits in just 3 2/3 innings of starting action.
It was the 600th win in the managerial career of Pirates skipper Clint Hurdle.
"It was a nice game to win tonight," said Hurdle. "I don't have many balls in my collection. I think the first one I got was for my 500th win. Andrew (McCutchen) handed me the ball tonight and I think I'll keep this one."
Carlos Lee hit a two-run home run while Matt Downs and Clint Barmes each added solo shots for the Astros, who have dropped five of six. Wilton Lopez (2-6) got the loss and J.A. Happ lasted five innings in the start as he was charged with four runs on five hits with eight strikeouts and four walks.
"That was our game to win tonight," said Houston manager Brad Hawpe. "We've had a few of them like that this season, but this one is really tough to swallow."
The game had been tied since McCutchen's three-run blast in the fifth, but the Buccos took the lead in the bottom of the eighth.
With Lopez on the mound, Garrett Jones singled with one out and Ryan Doumit followed with a single. Sergio Escalona then took the hill and Jaramillo punched a single to right that scored Chase d'Arnaud, who was pinch-running for Jones.
On the run-scoring play, Jaramillio was tagged out in a run-down between first and second and Doumit was then thrown out at home to end the frame.
Joel Hanrahan set the Astros down quietly in the ninth for his 36th save of the season.
Houston used the long ball early to take the lead as Lee hit a two-run home run after a J.D. Martinez single and Downs followed with a shot off the left field foul pole.
McCutchen's first homer of the game came in the first to make it a 3-1 contest.
Barmes' solo shot in the fourth, his 10th of the season, made it a 4-1 contest.
The fifth, though, saw the Pirates tie the game. With one out, Brandon Wood walked and Alex Presley followed with a single. After Josh Harrison struck out, McCutchen crushed a pitch into the left field stands, his 22nd homer of the season.
The Pirates have hit a home run in five straight games, a season high...The Pirates host Florida for three games starting on Friday...Houston plays at Washington on Friday...Pittsburgh took 11 of the 18 games against Houston this season.