Locke had two losses and five no-decisions since his last victory. He threw seven innings and scattered three hits and a walk while giving up one run. He recorded five strikeouts to improve to 10-5 on the year.
"Locke just had better stuff," Pirates manager Clint Hurdle said. "You saw the rhythm and the command. I think he was able to stabilize himself the last time out and find some rhythm, find some confidence. He had confidence, but some tangible confidence after giving us a good solid outing and keeping us in the game, and today you saw it. He was aggressive getting the ball glove side for strikes, breaking ball played, the change up, the mix of pitches was very, very good. He did a real nice job with Russell Martin as far as the sequencing and one walk and five K's was a fresh outing, very solid."
"I just think you've got to keep building on it," Locke said. "Nothing has really changed with me mentally. Yeah, I had the break in between, but I'm still trying to go out there and attack and be aggressive, and tonight was just an example of everything going the way you'd like it too."
Cubs catcher Welington Castillo gave a tip of the cap to Locke.
"He was making his pitches and had really good command on his fastball and breaking ball," Castillo said. "When a team like that gets hot, everybody gets hot. You have to give them credit. He made his pitches, and he was really good."
Locke retired the last 10 batters he faced and was very effective pitching inside.
"Early on we were inside, and as the game progressed a little bit we mixed up the pitches a little bit more," Locke said. "But you know they have an idea too what I like to do. I've thrown against them a couple times this year, but you're not going to go away from what works, and that's something that Russ [Martin] and I stuck too pretty well tonight and we're very fortunate we won the game."
Locke benefited from some outstanding defense, in particular two defensive gems from Jordy Mercer and Andrew McCutchen.
"We're just doing all we can do to keep Locke out there and keep the flow of the game going," Mercer said. "Locke was in a rhythm, a really good rhythm, all night and that's what we want to do is keep him in the rhythm."
Cubs lefty Chris Rusin (2-4) tossed seven innings, allowing two runs and four hits.
"The left-hander Rusin was tough," Hurdle said. "We squared up a handful of balls early, and he was mixing his pitches well. So we found a way to scratch out a couple runs there and then added a big run when Clint Barmes and Mercer got something going there in the eighth inning and plated that third run."
Cubs manager Dale Sveum liked the outing he got from Rusin.
"He did a great job against a lineup that kills left-handers," Sveum said. "That was, to me, his most impressive outing."
The Cubs nicked Locke for a run in the third. Darnell McDonald led off with a double, and with two outs, Starlin Castro hit an RBI single to left.
The Pirates got to Rusin on his second trip through the batting order. With one out in the fourth, Mercer singled. McCutchen doubled off the third-base bag, and Justin Morneau hit into a fielder's choice with Mercer getting tagged out at home. With runners on first and third, Marlon Byrd singled to drive in McCutchen.
Pedro Alvarez singled off the bottom of the wall in right, knocking in Morneau and giving the Pirates a 2-1 lead.
The Pirates added an insurance run in the eighth off Cubs reliever Blake Parker. With two outs, Barmes singled and then came home on a double by Mercer.
"Any time you can scratch out any extra runs there to give [Mark] Melancon a little bit of breathing room it's a plus," Mercer said. "That situation right there, I wasn't trying to do too much and luckily put it in the gap and Barmes ran his tail off and was safe."
Tony Watson pitched a scoreless eighth inning for the Pirates. Melancon worked around a wild pitch on a strike three and a single to earn his 14th save.
"We're just rolling a little bit right now after we had that big series in St. Louis and we slumped a little bit," Locke said. "You just want to come home and get the ball in the first game back home and be as sharp as you can, and fortunately I had a lot of help on defense, but for the most part I did my job pretty well."