LOS ANGELES -- Something old: the Mark Melancon-Jason Grilli endgame.

Something new: Clint Barmes twice singling and scoring on Josh Harrison singles, a parlay with certain long odds.

Something borrowed: Gaby Sanchez coming up with a big pinch-hit double.

Nothing for the Blue: The Pirates turned the preceding, and Gerrit Cole's hard nose, into a 6-3 victory over the Dodgers.

Cole, the recent pride of the UCLA Bruins, found a surefire way to muffle the expected emotions of pitching in front of three dozen friends and family members within a few miles of Westwood.

"We're playing the Dodgers," he kept reminding himself of the rather large task at hand.

It worked, pulling him back from the ledge every time the Dodgers nudged him out there.

At their least likely place, the Bucs thus produced a turnabout effort that put more than the 2,300 land miles between them and two gruesome days in New York.

"A real good ballgame for our club, all the way around," said manager Clint Hurdle, only a few hours after having called his team's previous two games, against the Mets, their worst of the season. "Off the mound. Defensively. The offense responded well. It was just really fun to watch us get out there and play."

Hurdle got to see something he had not since May 9, 2011: his Pirates win in Dodger Stadium, after nine consecutive defeats.

The Bucs did so in impressive fashion, scoring all six of their runs with two outs.

Leading the way with three hits was Barmes, who started at short to provide Cole with air-tight defense, but who went into the game 4-for-26 against Dodgers starter Dan Haren. Barmes came out of it 6-for-28, and for good measure also triggered the winning rally against setup reliever Brandon League with another single -- dotting his first three-hit game since Sept. 20, 2012.

The Bucs provided their own replay review. In both the fifth and seventh innings, Barmes singled, took second on Cole's one-out sacrifice bunt and scored on Harrison's two-out single.

"The way J-Hay's been swinging," Barmes said, "anyone on base definitely has a chance to score. It's nice that I was in that situation. Gerrit coming up behind me and getting bunts down were huge, giving Josh an opportunity to drive me in."

"Barmes prepares; he is always ready," Hurdle said of the veteran who made only his 15th start of the season at short. "When he's played, his at-bats have been good. And J-Hay has really given us a good solid dimension atop the lineup. It was nice to see us start something at the bottom and finish it off."

Cole went 6 1/3 innings for his fifth victory, staying with Haren until his Pirates mates could go off on the Los Angeles bullpen. And his own bullpen could drop curtain: Tony Watson, Melancon and Grilli -- earning his sixth save -- pitched one-hit ball over the final 2 2/3.

The Bucs displayed refreshing offensive resilience, responding both times the Dodgers went ahead or caught them.

"That's the one thing we do: Something happens in a negative way, we move on," Hurdle said. "It was real good to see us answer that way."

"We played Pirates baseball," said Cole, still visibly psyched 15 minutes after the game had ended and an hour after he'd left the mound. "Passed the baton at the plate. Swarmed on defense. Threw a lot of strikes, pitched in, took some punches."

The final retort was decisive. Minutes after Cole's 3-2 lead was erased in the bottom of the sixth, the Bucs broke open the game with a three-run seventh.

They did so against the recently flawless League, who took over after Haren had worked six innings. League had not given up an earned run in 16 appearances, since April 16.

After the Barmes-Cole-Harrison connection snapped the 3-3 tie, Neil Walker's single scored Harrison and, after Andrew McCutchen walked and lefty Paul Maholm relieved, Sanchez's double scored Walker.

Pedro Alvarez's homer in the second, his 10th, briefly tied it at 1-1, the Dodgers going back ahead in the bottom of the inning on Dee Gordon's RBI single.

It took less time, and with less damage already inflicted, for Cole to get his bearings than it has for some other Bucs starters who have experienced rough outsets.

His biggest challenge came after the Bucs had rewarded his tenacity by rallying into a 2-2 tie in the fifth, on the first Barmes-Cole-Harrison connection.

Did Cole have a shutdown inning in him? The answer -- a resounding "Yes!" -- came in only six pitches. That's how many he needed for three outs that ran his streak of hitters retired to 10.

Russell Martin's home run -- the ex-Dodgers catcher's first here since July 9, 2010, and first anywhere since April 9 -- in the sixth gave the Bucs their first, fleeting lead.

"I made a bad pitch to Martin, a split that popped up out of my hand," Haren said. "We came back to tie, but I'm really mad about that pitch. It was one of those you hope they foul off."

Cole made six pitches to the leadoff batter in the sixth alone, and it did not end well as Yasiel Puig ripped No. 6 to the base of the right-center wall for a double. Hanley Ramirez followed with the game-tying single.