DENVER (AP) Jordy Mercer's defense helped get the game to extra innings and his offense put Pittsburgh over the top.
Mercer hit a tiebreaking RBI double in the 12th inning, and the Pirates continued their mastery of the Colorado Rockies with a 9-8 marathon win Wednesday night.
It was the second time in four games the Pirates won in extra innings after blowing a late lead. They rallied to beat Arizona on Sunday before pulling out Wednesday's game for their fourth straight win.
''We keep playing,'' manager Clint Hurdle said. ''We play with emotion, not emotionally.''
Kyle Lobstein (2-0) tossed three scoreless innings and Mark Melancon pitched the bottom of the 12th for his fifth save for Pittsburgh, which has won eight straight in Denver.
The Pirates last lost at Coors Field on July 27, 2014.
They were able to keep the streak going with some key plays from Mercer. After the Rockies loaded the bases with no outs in the sixth, he threw out Nick Hundley at third when Cristhian Adames' grounder up the middle went off second baseman Josh Harrison.
''I did see Nick take a step back at second so I knew we had a shot at third,'' Mercer said. ''I just picked up the ball and threw to third. It worked out.''
He followed that with his winning hit in the 12th.
Gregory Polanco homered in the seventh inning and also drew an eight-pitch walk off Carlos Estevez (0-1) before Mercer's double. Mercer ripped his drive to right-center to plate the winning run in a game that took 4 hours, 58 minutes.
''A lot of times you get into extra innings you want to pop one out of the park or do something crazy, I just wanted to get something to drive and I was able to hit it up the middle,'' Mercer said.
Trevor Story and Nolan Arenado each hit their ninth homers of the season as part of Colorado's four-homer night. Mark Reynolds and Gerardo Parra also went deep for the Rockies, who have lost five straight.
''We've lost some tough ones. But sometimes that's the price you pay for fighting your way back into games, and you end up getting your heart broken because you keep competing,'' Rockies manager Walt Weiss said. ''That was one of those nights.''
Rockies starter Jon Gray allowed six runs on nine hits in his second start since coming off the 15-day disabled list.
Pittsburgh starter Jonathon Niese cruised through the first three innings before Colorado rallied. Story and Arenado hit solo home runs in the four-run fourth, and Niese left after loading the bases with no outs in the sixth.
Polanco's deep drive to left gave the Pirates an 8-5 lead.
Pirates: INF Jung Ho Kang (left knee) was in the lineup for Triple-A Indianapolis on Wednesday. It is the second time Kang has played in back-to-back games since starting his rehab assignment April 17. He is expected to be out until at least early May.
Rockies: LHP Jorge De La Rosa was placed on the 15-day DL with a left groin strain, and Colorado recalled RHP Eddie Butler from Triple-A. The move comes a day after De La Rosa allowed four runs in three innings against the Pirates. ... OF Charlie Blackmon (turf toe) went 1 for 4 in a rehab assignment for Class A Modesto on Wednesday.
Mercer's double in the 12th meant that every starting position player in the game had at least one hit.
Gray's quick exit was due in part to his high pitch count. The rookie needed 96 pitches to get through 3 2/3 innings, and 23 of those were foul balls. The Pirates were locked in with two strikes, fouling off 12 of those offerings.
''I feel like attacked everything I was supposed to tonight,'' Gray said. ''That was the game plan, I feel like I did it. But the results didn't match up.''
FILE UNDER IRONIC
The Colorado Rockies postponed Thursday's scheduled Weather and Science Day at Coors Field due to ... weather. The interactive event - put on by the Rockies, Colorado State University and the local NBC affiliate - will now be held May 11.
Pirates: RHP Juan Nicasio (2-2) will make his second start against his former team. Nicasio, who was with the Rockies from 2011-14, is 0-0 with a 2.70 ERA in six appearances against Colorado
Rockies: RHP Tyler Chatwood (2-2) lasted just four innings in his last outing, a loss to the Dodgers on Saturday.