Miami's Christian Yelich turned on an inside two-seam fastball and sent it halfway up the right field seats against Locke in the second inning. No Marlins hitter reached second base against the starter the rest of the way.
"I guess when damage is done, it's better that it's done quick. I just tried to get in a groove and stay in a groove for as long as I can," Locke said. "Guys are going to put balls in play. Guys are going to get hits. You try to limit as much as you can and try to put the ball on the ground. I think we did a pretty good job."
Locke threw seven innings and matched a season best with seven strikeouts, doing so without walking a batter. Three of the six hits he allowed came in the first inning, and even on Yelich's homer, catcher Russell Martin said, "it wasn't over the middle of the plate. You have to give some credit to the hitter, no question."
The 26-year-old Locke was pleased with his outing because he got stronger as the game went along. His manager shared those sentiments.
"It's as well as he's pitched all year, from the end of the third through the seventh," Clint Hurdle said. "All his pitches were working."
A big first inning from the Bucs' bats allowed Locke to pitch with the lead the rest of the game. The first four Pirates who stepped to the plate against Marlins starter Tom Koehler came around to score.
Josh Harrison -- who went 3-for-4 and extended his hitting streak to 10 games -- started the frame with a double down the third-base line. Koehler then loaded the bases with walks to Gregory Polanco and Martin, and Ike Davis gave the Pirates the lead with a ground-rule double.
"It was nice to answer back after they scored the first run in the first inning," Martin said. "Our starters appreciate it. It gives us a little breathing room."
Like Locke, Koehler settled down as the game progressed. He allowed just two hits in his final five innings and had a stretch in which he retired 10 of 11 hitters. But the one poor inning was enough for Koehler to pick up his eighth loss.
"They're a very good fastball-hitting club," the righty said. "Any time you walk two guys in one inning and give up a double, it's going to end up being a tough inning."
Once the Pirates got the Marlins' bullpen, their offense woke back up.
Their three-run seventh inning started with a one-out single by none other than Locke, who got the at-bat due to a slim bench. Three batters later, Martin sent an RBI single to left-center off reliever Mike Dunn, and pinch-hitter Gaby Sanchez followed with a two-run double.
The Pirates made the most of their opportunities. In the two innings they scored, they had seven hits and 11 men on base. In the six innings they didn't, they had two hits and three baserunners.
"It always plays better when you can put up crooked numbers," Hurdle said. "We got good at-bats from start to finish in the first. Guys hit the ball that was pitched, we had good looks, we capitalized on the two walks. And later on, Russell sparked us and Gaby was able to put one over [right fielder Giancarlo] Stanton's head."
Pittsburgh's relievers picked up where Locke left off. After being unavailable Tuesday, Tony Watson tossed a perfect eighth with two strikeouts.
Mark Melancon threw a scoreless ninth, allowing a two-out single to Marcell Ozuna. The hit gave the Marlins their first baserunner since Jeff Baker singled against Locke in the third and snapped a streak of 18 consecutive outs for Pirates pitchers.