It was the second scoring pass of the game for Davis, who went 6-of-13 for 50 yards. Kellen Clemens started the game for the Rams and completed 13-of-18 for 188.
Baltimore played the entire contest with Caleb Hanie at quarterback. He was 20-of-39 for 272 yards and a touchdown, but was intercepted twice.
Davis' first touchdown pass was a 4-yarder that went to Nick Johnson early in the fourth period and gave St. Louis a 17-14 lead.
The Ravens then regained the advantage on a 50-yard throw from Hanie to Marlon Brown.
St. Louis won for the first time in exhibition play. Baltimore wound up 2-2.
Baltimore will open defense of its NFL title by visiting Denver next Thursday in the first game of the NFL's 94th regular season. St. Louis will begin its campaign at home against Arizona on Sept. 8.
Swim Week Miami Beach 2014 [PHOTOS]