In the ninth, the Pirates tied it when the Astros' Ben Orloff lost a short popup in the sun, allowing Evan Chambers to score.
Orloff gave Houston a 7-6 lead with an RBI single in the eighth. Teammate J.B. Shuck's three-run triple in the seventh had tied it at 6.
An RBI single by catcher Rod Barajas and a two-run, bases-loaded single by Garrett Jones highlighted a three-run seventh for the Pirates as they took a 6-3 lead. All three runs came off Jarred Cosart, the Astros' top pitching prospect, who was making his Grapefruit League debut after coming over from Minor League camp.
Houston starter J.A. Happ pitched a spring-high five innings, but it wasn't easy. He allowed nine hits, three runs and three walks and struck out one while throwing 54 of his 83 pitches for strikes. Pirates starter Brad Lincoln allowed four hits and three runs in four innings.
Jed Lowrie gave the Astros a 1-0 lead in the first with a homer down the right-field line, and catcher Chris Snyder belted a two-run home run to left field in the third to make it 3-0. It was the third homer of the spring for Snyder, who hit three last year in 96 at-bats with Pirates.
Barmes, who played for the Astros last year, singled home Eric Fryer in the third, and Fryer's bases-loaded sacrifice fly in the fourth cut the lead to 3-2. The Pirates tied it at 3 in the fifth on a two-out triple by Yamaico Navarro.
Cosart was electric in his first appearance in big league camp, striking out the side in the sixth before running into trouble in the seventh. In 3 1/3 innings, he allowed four runs on seven hits, walked one and struck out five.
Up next: Erik Bedard is scheduled to start against Tommy Hunter when the Pirates play the Orioles on Monday at 7:05 p.m. ET in Bradenton. Kevin Correia and Joel Hanrahan will be pitching in Pirate City in a camp game.