Trailing 3-2 and down to their final out in the bottom of the ninth, Los Angeles struck for two runs to stun the Cardinals.
Andre Ethier collected a single off St. Louis closer Jason Motte (4-5) and pinch-runner Dee Gordon stole second.
The next batter, Cruz, then unleashed a liner to center field that just eluded the glove of a diving John Jay, rolling to the wall for a score-tying double.
Rivera followed by dumping a flair that bounced off the glove of second baseman David Descalso, chasing home Cruz with the winning run.
The victory pulled the Dodgers into a tie with the Cardinals for the second National League wild card spot and gave them a 2-games-to-1 lead in their four-game series.
The rally made a winner of Ronald Belisario (6-1), who tossed 1 1/3 scoreless innings.
Allen Craig went 2-for-4 with a two-run homer and three RBI for St. Louis.
Notable deaths of 2014 [PHOTOS]