Locke (2-1) yielded just two hits and a pair of walks as the Pirates reeled off their fourth victory in five games.
Jason Grilli struck out two batters in the ninth inning en route to his eighth save of the season.
Phillies starter Cole Hamels (0-3) pitched well in the loss, allowing two runs on seven hits and a walk over eight innings. The left-hander struck out six.
Celebrity Breakups and divorces of 2014 [PHOTOS]