Cashner (10-8) faced the minimum 27 batters in the 97-pitch gem, taking a perfect game into the seventh inning before Jose Tabata led off with a single -- the only base runner Pittsburgh could muster in the contest.
The right-hander struck out seven in posting his first career shutout as San Diego took the opener of a four-game series.
Wil Venable and Jed Gyorko each supplied a seventh-inning RBI single to break a scoreless tie.
Pittsburgh's A.J. Burnett (8-11) was tagged with the loss, surrendering the two runs on six hits in a 6 2/3-inning effort. He walked three and struck out eight.
The Pirates came into the contest tied with St. Louis atop the National League Central.
'Happy' fan videos make Pharrell cry [VIDEO]
Pregnant Mila Kunis wins 'Best Villain' at MTV Movie Awards