"Even though we've had our share of bumps and bruises, we're going to hit a stretch where we start playing well and put together a string of games like we played tonight," Porter said. "It's a tremendous group of guys in that clubhouse. It's a resilient group. They have fun together. They love playing game. They play hard."
Castro doubled off the top of the center-field fence against Bryan Morris (1-2), and Carlos Pena was intentionally walked one out later. The runners moved up on a wild pitch and Castro scored when he beat second baseman Neil Walker's throw home on Matt Dominguez's fielder's choice grounder.
Pittsburgh manager Clint Hurdle argued the call with plate umpire C.B. Bucknor and was ejected. Pinch-hitter J.D. Martinez followed with an RBI single to make it 4-2.
"I thought he was out, but I watched the replay and I was wrong. C.B. got the call right," Hurdle said.
Porter credited good baserunning on Castro's part for scoring the winning run.
"Castro had a great heads-up read on contact and made a great slide," Porter said.
Rookie Jose Cisnero (1-0) struck out five in 3 2/3 scoreless relief innings for his first major league win. Jose Veras pitched a scoreless 11th for his sixth save as Houston (12-31) won for the second time in three games since losing six in a row.
"Anytime you get that kind of push like that from someone out of the bullpen, he probably should have got the win and the save, too," Hurdle said.
Porter was hoping Cisnero could provide multiple innings from a bullpen that has been overworked of late.
"In that situation, we have some guys who have been worked hard the last few days," Porter said. "We didn't have many guys available. Most of the guys we had (warming) up were for show. It was pretty his game until we took the lead and then we were going to hand it over to Veras."
Houston's Jose Altuve had three hits to raise his batting average to .342 after being activated from the bereavement list before the game. Altuve missed three games after his grandmother died in his native Venezuela.
Pittsburgh starter A.J. Burnett held Houston to one run in seven innings while allowing five hits and four walks, but wound up with a no-decision when Melancon could not hold the lead. Burnett struck out seven to raise his National League-leading total to 79. He has not allowed more than three earned runs in any of his 10 starts this season.
"You can talk about (the Astros') record, but they're all big leaguers, they're all up here for a reason," Burnett said. "They battled me. They had some really good swings with two strikes and they fought off some tough pitches. I felt good to get out of it with only one run allowed."
The Astros' Erik Bedard gave up two runs and seven hits in six innings with three strikeouts and no walks in his first career start against Pittsburgh. The veteran left-hander was the Pirates' Opening Day starter last season, but was released on Aug. 30 after going 7-14.
"You don't really think about who it's against," Bedard said. "You just want to win the ballgame."
Inge put Pittsburgh in front 2-1 in the sixth when he hit a two-out RBI single to left field off Bedard.
The Pirates scored the game's first run on consecutive doubles by McCutchen and Gaby Sanchez with two outs in the first inning.
Houston tied in the fifth on Altuve's two-out RBI single.
Houston INF Jake Elmore was optioned to Triple-A Oklahoma City to make room on the roster for Altuve. ... Porter said Saturday that OF Brandon Barnes, his best defensive outfielder, was unavailable to play in Friday night's 5-4 loss to Pittsburgh because of a sprained right ankle. That is why RF Jimmy Paredes, who dropped Pittsburgh C Russell Martin's two-out fly ball in the ninth inning to allow the winning run to score, was in the game. On Saturday, Barnes entered in the bottom of the 11th for defensive purposes. ... Pirates RHP Jeff Karstens (right shoulder inflammation) allowed two unearned runs in four innings Saturday night for Double-A Altoona in a rehab start at Richmond in the Eastern League. ... The three-game series concludes Sunday with Houston RHP Lucas Harrell (3-4, 5.11) pitching against LHP Jeff Locke (3-1, 3.15).