The pair scored only 48 seconds apart late in the game to turn a 2-1 deficit into a 3-2 lead.
Hornqvist's wraparound of a rebound with 3:34 to play tied the game, and seconds later Martin Erat fed a pass from behind the net to Boyd, who one-timed it home with 2:46 to play for his second goal of the game.
Pekka Rinne made 23 saves in Nashville's sixth straight win. The victory gave the club 89 points and kept it two points ahead of Los Angeles for the fifth spot in the Western Conference.
The Blues got a goal and an assist from Carlo Colaiacovo and one goal from David Perron. St. Louis fell to six points behind Detroit for the eighth and final playoff spot in the Western Conference.