Cashner (2-2) struck out four and walked three in the longest outing of his career. Dale Thayer finished the five-hitter in front of a season-low crowd of 14,596 at Petco Park.
Miami was shut out for the fifth time this season, tying Atlanta and Philadelphia for most in the majors. The Marlins are last in the league with a .226 team batting average and 98 runs this season.
Jedd Gyorko homered for the third time in six days and Chase Headley had an RBI double for San Diego, which has won four of five and nine of 12. It was the Padres' first shutout the season.
Wade LeBlanc (0-5) allowed four runs, three earned, and four hits over five innings in his first career start against his former team. The left-hander is 0-7 with a 6.35 ERA in his last 12 appearances dating to last season.
Miami handed a run to San Diego when catcher Rob Brantly dropped Carlos Quentin's two-out popup in the first, allowing Everth Cabrera to score from second.
Gyorko connected in the second, driving a 1-0 pitch over the wall in center for his third homer of the season. Gyorko is batting .333 with six RBIs in his last 14 games.
San Diego added two more runs in the fourth. Nick Hundley scored from second on a single from Chris Denorfia, getting his hand just underneath the tag in a tight play at the plate. Denorfia advanced on the throw by right fielder Marcell Ozuna and scored on Cabrera's single to right that was another close call at home.
NOTES: Headley extended his hitting streak to 11 games. ... Cabrera also walked twice and scored twice.