The Pirates rallied after two outs in the 12th against reliever Fernando Rodriguez, getting a softly hit double to left by Clint Barmes, who entered the game as a pinch-runner two innings prior. Josh Harrison stroked the next pitch to left score Barmes just ahead of the throw from Justin Maxwell.
The Astros fell to 6-7 in one-run games, and 0-4 in extra-inning games.
"I was trying to go away [to Barmes], and he's going to be aggressive in that spot, especially with the way he's been doing," Fernando Rodriguez said. "I thought it was just more of a reaction, trying to somehow get the bat on the ball. The next pitch, that was what I wanted to do with Harrison. I threw him a cutter down and away and he was able to flip it in there again, too. It was just one of those find-a-hole things."
Barmes, who played with the Astros last year and has been struggling mightily in 2012, was batting after the previous five Pirates hitters had struck out against Houston relievers Wilton Lopez and Wesley Wright.
"Getting a hit like that is certainly more fun," Barmes said. "Personally, I expect it to start me on an upswing. I'm confident there will be better days."
Astros closer Brett Myers blew his first save of the season after converting his first nine opportunities in his return to the closer's role, giving up a sacrifice fly to Pedro Alvarez in the ninth to allow the Pirates to tie the game at 2.
Myers got in trouble by allowing a leadoff walk to Jose Tabata, who took a half swing at a 3-2 pitch that was called a ball. Myers and the Astros' dugout wanted plate umpire Jim Reynolds to ask for help from the first-base umpire to determine if Tabata did indeed swing.
"He swung at it," Myers said. "I looked at [replays] in [the clubhouse]. That's just my opinion. The bat is straight across the plate and they didn't even check it. ... That's the way it goes sometimes. Some calls go your way and some calls don't. I shouldn't have been in that situation."
Neil Walker followed with a double down the right-field line, and the Astros intentionally walked Andrew McCutchen to load the bases with no outs for Alvarez, who lifted a sacrifice fly to left to scoring the tying run.
"Myers made some good pitches, we didn't get the calls and that's the way it was," Astros manager Brad Mills said.
The Astros' offensive struggles were front and center once again. Houston managed six hits, only one of which went for extra bases. Since banging out 15 hits May 2 against the Mets, Houston is hitting .197 as a team over the last nine games.
The top three hitters in the batting order -- Jordan Schafer, Jed Lowrie and J.D. Martinez -- went a combined 0-for-14 on Sunday.
"It's been tough, but we've managed to stay in games," said Carlos Lee, who was 2-for-5 with two runs scored and a double. "We've played good. Our pitching is really keeping us in the games. We're finding ways to score enough runs; we didn't do it today, but if we keep battling like this, we're going to win a lot of games."
Rodriguez needed 23 pitches to get out of the first inning, giving up back-to-back doubles to Walker and McCutchen with one out to allow the Pirates to take a 1-0 lead. He clamped down to retire 21 of the next 22 batters he faced, including the final 13.
Rodriguez, who lowered his ERA to 1.99 through eight starts, threw 72 of his 94 pitches for strikes. He threw first-pitch strikes to all but three of the 27 batters he faced. Rodriguez said he could have pitched the ninth.
"He had thrown the ball extremely well. Was he tiring? I think it was a situation he still had plenty of pitches to go," Mills said. "We're put into a situation where Tabata will be the first hitter [in the ninth] and McCutchen would have been the third hitter and they've been swinging the bat [well] this series. It was the right thing to do to get Myers in the game. Weather-wise and mound-wise and everything, it was tough."