PITTSBURGH (AP) -- After getting the hanging slider he was looking for, Drew Sutton thought the ball needed some help after he made contact with it.
''I knew I hit it well,'' Sutton said, ''but I didn't know if it was deep-straightaway-center well.
''But I was yelling at it.''
Soon, so was everyone else at PNC Park.
Sutton hit a one-out solo homer in the bottom of the ninth and the Pittsburgh Pirates improved to eight games over .500 for the first time in 20 years with an 8-7 win over the Houston Astros on Tuesday night.
Acquired via waivers last week, Sutton homered for the first time since Oct. 3, 2010, lifting the Pirates to their sixth walkoff win of the season, the second via a home run.
''It's why we play the game,'' said Sutton, who is with his third team this season. ''Even guys like me, who bounce around from team to team, every once in a while, you get a moment. You'd better enjoy it.''
Unlike in recent years, the Pirates have had plenty of enjoyable moments lately. Pittsburgh (44-36), which has won six of seven, is this far over .500 for the first time since the final day of the 1992 season.
That was the most recent season in which the Pirates had a winning record, 1992. A North American major professional sports record 19 consecutive losing seasons have followed.
Pittsburgh rallied from deficits of 4-0 and 6-2 to take a 7-6 lead on a Garrett Jones two-run homer in the seventh. But with Houston down to its last strike in the ninth, pinch-hitter Jason Castro drove in Jed Lowrie with a double.
''Our resiliency has always been there, and now it's showing,'' said Pedro Alvarez, who had a pinch-hit two-run single in his first action since leaving a game Sunday with leg cramps. ''It's selflessness from everybody. When you have group of guys who are invested in each other, things like that show.''
Andrew McCutchen continued his recent torrid pace by going 3 for 4 with a home run, taking over the National League batting lead at .360. He is 7 for 9 in the series and 13 for 18 in his past four games.
Sutton had three hits and Jones and Casey McGehee each had two hits for Pittsburgh, which has homered in each of its past 11 games. That's the team's longest stretch since a 13-game streak June 19-July 3, 1994.
Houston has lost six straight and eight in a row on the road.
Sutton took a 1-1 pitch from Wesley Wright (0-2) into the bullpen beyond the center field wall, giving the Pirates their 17th win in their past 22 home games.
''We've been in a good place for a while now,'' manager Clint Hurdle said.
''But I didn't have Sutton, home run, right-handed, to center field. I was just looking for a way to get a man on base and give Cutch a chance to swing the bat - and he kept Cutch from having to go up there.''
Earlier, it appeared as if Jones' line drive home run to right off Brandon Lyon in the seventh would be Pittsburgh's dramatic homer. It followed a McCutchen infield single, giving Jones home runs on consecutive days and three in the past five games. He has 12 on the season.
The lead didn't hold, though, because of Castro's hit off closer Joel Hanrahan. It was the third blown save in 23 opportunities for Hanrahan (4-0).
A.J. Burnett's career-high eight-start winning streak - longest by a Pirates pitcher since 1974 - was snapped. He allowed six runs and 12 hits in five-plus innings but came away with a no-decision when the Pirates rallied against Lucas Harrell and Lyon.
Similar to teammate Jordan Lyles the day before, Harrell cruised through the first three innings but was hit hard after that. Harrell allowed only an infield single and had six strikeouts through three innings, but McCutchen followed a Sutton leadoff single in the fourth with his 16th home run and fourth in his past 10 games.
''I felt like I threw the ball great today,'' Harrell said. ''There at the end, everything kind of feel their way. They're a team that has been winning and once the ball started rolling, it was a snowball effect.''
Houston had taken a 2-0 lead in the second off the first of Schafer's two RBI singles and a Jose Altuve sacrifice fly. They added single runs in the third (Scott Moore's RBI double) and fourth (Lowrie's RBI single) and two in the sixth to answer the Pirates.
Notes: Dock Ellis was the previous Pittsburgh pitcher to win eight consecutive starts in 1974. Ellis also won 10 straight outings in 1971. ... Before the game, the Pirates recalled OF Gorkys Hernandez from Triple-A Indianapolis, optioning OF Jose Tabata to the team. Hernandez entered the game in the fifth inning to replace Alex Presley. Presley left the game due to concussion-like symptoms sustained while diving for a Lowrie hit in the first inning. ... Astros 3B Chris Johnson (left side strain) missed his third consecutive game. He hit off a tee and took ground balls Tuesday, and manager Brad Mills said it was possible he would return during this series. ... Mills said RHP Wilton Lopez (right elbow sprain) will go on a rehabilitation stint in the minors and soon thereafter be activated from the disabled list. ... Astros OF Justin Maxwell (left ankle) rejoined the team after electing against surgery and will go on a rehab stint over the All-Star break. ... Houston first base coach Bobby Meacham is away from the team for personal reasons. Matt Sinatro, the team's catching and advance scouting coordinator, is filling in. ... Wednesday's Pirates starter, RHP Kevin Correia, has never beaten the Astros in nine starts. Houston's LHP Dallas Keuchel (1-0, 1.35) will make his fourth career start.