Herrera doubled in the fourth inning, threw out a runner from center field and started the ninth against Yimi García (3-3) by driving a full-count fastball in front of the right field wall just over a leaping Garrett Cooper, who had pinch hit in the eighth.
Alec Bohm struck out, and Matt Joyce was intentionally walked.
With runners at the corners, Torreyes hit a one-hopper to García, who rather than throw home decided to spin and throw to second.
Torreyes beat second baseman Isan Díaz’s throw to first to avoid an inning-ending double play as Herrera, who briefly stopped off third when García fielded the ball, scored. The call on the close play at first was upheld in a video review.
Cooper’s RBI single off José Alvarado (4-0) had tied the score in the eighth.
Hector Neris worked around a leadoff walk in the ninth for his ninth save in 11 chances. getting Jon Berti to ground into a game-ending double play.
Philadelphia won despite getting outhit 6-4.
Miami starter Pablo López, whose 13-inning scoreless streak was stopped by Hoskins’ homer, gave up two runs and four hits in seven innings.
Spencer Howard allowed one run, two hits and three walks in four-plus innings.
Philadelphia took a 2-0 lead in the fourth. Rhys Hoskins homered on a changeup after dodging a 95 mph fastball near his head. Herrera doubled and scored on Matt Joyce’s sacrifice fly.
Ranger Suárez relieved with the bases loaded in the fifth and allowed Jesús Aguilar’s sacrifice fly to Herrera, who threw out Díaz trying to advance to third.
Suárez allowed one hit in three scoreless innings.
Miami infielder Jazz Chisholm sat out for the second consecutive game. Chisholm due to a sore right ankle.
1B Lewin Díaz was recalled by Miami from Triple-A Jacksonville and went 0 for 4 with three strikeouts in his first big league appearance this season.
Marlins: OF Starling Marte (broken rib) played six innings and went 0 for 3 in his second rehab game at Jacksonville on Wednesday. … RHP Nick Neidert (right biceps inflammation) was placed on the 10-day IL. Neidert started Wednesday’s game and allowed one run in four innings.
Phillies: RHP Zack Wheeler (4-2) starts Saturday’s series opener at Tampa Bay and LHP Ryan Yarbrough (2-3).
Marlins: RHP Cody Poteet (2-0, 1.06) is on the mound Friday at Boston and LHP Martín Pérez (2-2).