On came closer Mike Gonzalez, who had converted each of his previous six save opportunities. On this day, however, Gonzalez couldn't find the strike zone. Two hits and two bases-loaded walks later, Gonzalez was gone and the Pirates lead was down to one.
"I'm definitely disgusted with my outing," said Gonzalez. "Ollie threw a tremendous game. You've got to win that one. I've got to get down, and I've got to grind. I just didn't get it done today."
The Astros capped their four-run rally on Brad Ausmus' sacrifice fly to left field off of Salomon Torres.
"We helped immensely to set up the four-run ninth inning," said Pirates manager Jim Tracy. "The base on balls just killed us. Two runs come in on four-pitch walks.
"When you walk people, it's going to hurt bad. They didn't hit a ball hard in the inning."
Houston plated the winning run against Torres (2-2) in the 10th inning on Preston Wilson's RBI single.
"You've got to give [the Astros] credit for the way they battled coming back from a 4-0 deficit," said Torres. "They never gave up, just like we never gave up last night. It's tough to swallow, because we started to get momentum."
The late-inning collapse wasted another outstanding effort from the enigmatic Perez, who just two weeks earlier had been in jeopardy of being sent back to the Minor Leagues. Perez kept Astros hitters off balance by deftly mixing in his slider and changeup with a fastball that topped out at 94 mph. He entered the ninth inning having thrown 15 consecutive scoreless innings.
"That's a real tough game to lose because of the way that our starting pitcher performed," said Tracy. "I wasn't around here [in 2004] when he had the great year. But I don't know that there was any game that he pitched that he would have pitched much better than he did today."
After the game, Tracy defended his decision to send Perez back out for the ninth despite the fact that the lefty had already thrown 120 pitches through eight innings.
"He was throwing the ball too well to take him out," Tracy said.
Houston's comeback tarnished what had been an otherwise stellar afternoon for the Pirates, highlighted by Jason Bay homering for the sixth straight game.
Bay earned his second standing ovation from the home crowd in as many days with his solo home run in the fourth inning against Astros rookie starter Fernando Nieve. He joined Houston's Morgan Ensberg and Texas' Kevin Mench as just third player to go deep in at least six consecutive games this season.
Bay's 16th home run of the season was also his 10th long ball in Pittsburgh's last 10 games, and his 11th this month. Bay's 11 home runs in May are a Pittsburgh record for the month, and it is the most home runs a Pirates player has hit in one month since Brian Giles went deep 12 times in Aug. 1999.
"I still can't explain it," Bay said. "I'm still getting pitches to hit and hitting them.
"I'm just riding it out and hopefully it doesn't end for a while."
Bay, however, found little solace in his personal accomplishments on a day in which the Pirates wasted an opportunity to earn their first three-game series sweep since July 2004.
"This one is brutal," said Bay. "You could sense in the first inning that both teams were pretty tired. To get out to that lead and feel comfortable about it and then have it basically ripped away and lose that game, that one hurt."
Jose Bautista, whose sacrifice fly in the 18th inning on Saturday chased home Bay with the winning run, drilled a three-run home run in the seventh inning to stake the Pirates to a 4-0 lead.
Houston reliever Chad Qualls (3-1) retired the Pirates in order in the ninth inning to earn the win. Astros closer Brad Lidge tossed a scoreless 10th inning for is 13th save.
With the loss, the Pirates fell to 5-15 in one-run games this season.