The Oilers scored three times in the second period to take a 3-1 lead but the Blues tallied three times in the third to win their second straight.
Alex Pietrangelo brought St. Louis within one just 20 seconds into the final period and David Backes tied it less than 2 minutes later. Both goals came on the power play.
D'Agostini's game-winner was his ninth goal of the season. Carlo Colaiacovo assisted on all three third-period goals.
After giving up the three goals in the second period, Jaroslav Halak rebounded to get the win by making 29 saves. Devan Dubnyk allowed four goals on 37 shots.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Boston schools pull out free condoms over wrapping complaints