Ramirez was yanked from Monday's game for loafing and benched Tuesday after criticizing manager Fredi Gonzalez and teammates. The two-time All-Star apologized individually to the Marlins before the game.
Ramirez was booed before three of his first four at-bats. The reigning NL batting champion answered with three singles, two of them infield hits, and drove in a run.
Dan Uggla homered for the second straight game for Florida, which has won six of seven. The Cardinals lost for the first time in three games since Albert Pujols was moved to cleanup.
Cardinals rookie Jaime Garcia worked five scoreless innings and has not allowed a run in 19 innings at home. He escaped trouble in all but one inning, stranding nine runners, although the outing was his shortest of the year by an inning.
Sanchez (3-2) didn't give up a hit his last four innings and won his second straight start. He struck out Colby Rasmus all three times.
Matt Holliday had two hits batting third for St. Louis, but struck out in the eighth against Clay Hensley with two on and none out to fall to .160 (8 for 50) with runners in scoring position. Pujols followed with a double-play ball.
The Cardinals have totaled four runs on 12 hits the last two games.