Newest Pirate Drew Sutton delivered the latest crowning blow, with a one-out homer in the bottom of the ninth off Wesley Wright.
It was Sutton's first home run since the last day of the 2010 season, when he connected for the Cleveland Indians. Between long balls, he played 56 games for three different teams.
"It's why we play the game," Sutton said after toweling Burnett's walk-off pie off his face. "Even guys like me, who bounce around from team to team, every once in a while you get a moment that you better enjoy, because you don't know when it might come around again."
The victory moved the Pirates (44-36) eight games above .500 for the first time since the end of the 1992 season.
Garrett Jones had turned around a 6-5 deficit and earned the season's first curtain call from the 21,516 in PNC Park with a two-run homer in the seventh.
"Pretty cool. I don't think I've ever had one of those," Jones said.
He definitely meant the curtain call, not the home run: It was his second in as many nights and No. 12 of the season, and it completed the Bucs' escape from a 6-2 hole left by Burnett. It followed Andrew McCutchen's third hit of the night, a seemingly simple grounder to short that he beat out for an infield single.
"It was pretty special," Jones added. "A battle the whole game. They came out swinging, but we kept battling the whole way."
The Astros answered Jones' call, handing Hanrahan (4-0) his third blown save of the season with a ninth-inning rally culminated by pinch-hitter Jason Castro's game-tying double on a 3-2 pitch and two outs.
"Just a bad pitch," said Hanrahan. And it was delivered with bad timing: In any other count, which freed Jed Lowrie to take off from first on the release, the hit doesn't score a run.
McCutchen continued playing the game at his own level, putting the Pirates on the scoreboard with a two-run homer in the fourth inning. McCutchen's 16th blast broke the spell of Houston starter Lucas Harrell, who had struck out seven through the first three innings.
McCutchen had earlier singled, beating out a two-out grounder to deep short in the first inning. That gave the center fielder six consecutive hits, a streak that ended when he bounced into a force play in the fifth.
Pittsburgh turned it up in the sixth, when Casey McGehee's RBI single chased Harrell and Pedro Alvarez's two-run pinch-hit single off Fernando Rodriguez made it 6-5. Those two RBIs were the first in 14 career at-bats as a pinch-hitter for Alvarez, who had been in the original starting lineup before being scratched by lingering discomfort in the right leg that had cramped on him Sunday in St. Louis.
Manager Clint Hurdle called Alvarez's hit "absolutely" a key to the game.
"Just trying to put a good at-bat together," said Alvarez, "and produce somehow with a guy on third and less than two outs."
"His hit, obviously, really gave us some more momentum," Hurdle said. "Then Jones hits that ball, and you're thinking, 'OK, our chances are even better.'"
True to a baseball proverb, the ball kept finding the Pirates' hot spot. On Tuesday night, that was right field -- because it was freshly vacated by Jose Tabata, sent to Triple-A Indianapolis on a recovery mission.
Every one of the Astros' run-producing hits thus found its way to Sutton, who was making his second start there and gave evidence of being as dangerous as an outfielder as he is as a switch-hitter.
Jordan Schafer's run-scoring single and Jose Altuve's sacrifice fly in the second. Back-to-back third-inning doubles by Carlos Lee and Scott Moore. Jed Lowrie's RBI single in the fourth. Schafer's second RBI single and Lowrie's sacrifice fly in the sixth.
And, ultimately, naturally Castro's game-tying double.
All peppered Sutton, challenging his range and arm.
"Oh, man. I was getting worn out. How many balls did they hit into the corner?" Sutton wondered.
The last of those Burnett got to see from the mound was Schafer's second knock. In an outing that slowed his two-month surge to renewed prominence, Burnett allowed 12 hits and six runs in five-plus innings, with one unintentional walk and five strikeouts.
The six runs matched the total Burnett had allowed in his seven previous PNC Park starts of the season.
"I just like the way we hang together," Hurdle said. "If we get in a tight spot, we just kind of hang in there. If we get underneath, we just kind of try and scratch and claw and battle back."