They made it 6-4 in the ninth on RBI from Beltran and Allen Craig before Molina came up with two outs and stunned the Marlins by pounding a pitch from closer Heath Bell into the left field bullpen for a two-run shot.
The Cards scored two more in the 10th off Chad Gaudin (1-1), with the first coming on Rafael Furcal's RBI double.
The decisive play, however, was a run-producing infield hit by rookie pitcher Joe Kelly, who was forced to bat after Marlins Manager Ozzie Guillen caught Cardinals counterpart Mike Matheny in line-up mistake.
Jason Motte allowed a run in the bottom of the 10th but managed to hang on for his 15th save.
Victor Marte (2-1) earned the win for St. Louis, which notched its fourth triumph in five contests.
Jose Reyes supplied two hits and a pair of RBI for Miami.
Exploding whale video goes viral on Internet
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'