"Revenge." Smith said afterward with a grin. "Obviously that's not the way you want to win hockey games. But we got the win and that's the most important thing."
Kariya recorded the 10th hat trick of his career when he scored with 10.7 seconds left.
After Modano got the Stars on the board by beating Hannu Toivonen in the shootout, Smith got a little help when Lee Stempniak's attempt hit the post, giving Dallas its fourth straight victory and eighth in nine games.
"It was a wild one," Mike Ribeiro said. "We could have played better, but the win is the main thing."
Modano, who also scored his 519th goal in the third, and Smith stole the spotlight from Kariya, who now has 900 points in his NHL career.
Kariya last scored three goals April 18, 2006 against Detroit.
"Anytime you can contribute, it's nice," said Kariya, who hadn't scored a goal in his previous nine games. "I wasn't playing that well, especially the last four or five games. It was nice to help the team get a point. Obviously we're disappointed we're not getting two. But we hung in the game and battled through some adversity."
The Blues lost their third straight and snapped a 141:16 scoreless streak in the first period.
Ribeiro's career-best 21st goal of the season gave the Stars a 4-3 lead with 5:01 left.
Modano's goal 4:01 into the third gave Dallas a 3-1 advantage.
But Kariya started his run 90 seconds later with an unassisted goal from the left circle that cut it to 3-2. Kariya then took a pass from Brad Boyes and beat Smith at 10:31 to tie it.
"We've seen that before," Modano said. "He's a good player."
The Stars have won 16 of 22 games and were victorious a day after giving head coach Dave Tippett a contract extension.
"Points are fine," Tippett said. "But we have to play much better than that. We snuck one out."
Barnes attempted a centering pass that instead went off the skate of St. Louis center Keith Tkachuk and into the net at 9:01 of the first.
Tkachuk also played a part in ending the St. Louis' scoring drought. He picked up a loose puck in the slot and fed David Perron, who beat Smith from the left circle at 13:15 of the first.
"Obviously we're disappointed in the result," St. Louis coach Andy Murray said. "But you have to respect the battle of our team. We asked our veterans to set the example for our young players and I thought he did."
Smith made 27 saves, and Toivonen stopped 22 shots in a matchup of reserve goalies.
- Ribeiro has 11 goals and 20 points in December.
- St. Louis C Andy McDonald (pulled chest muscle) missed his second straight game.
- Stars LW Jussi Jokinen left late in the first period with a leg injury and did not return.
- Saturday night's game was part of an NBA-NHL doubleheader at the American Airlines Center. The Atlanta Hawks and Dallas Mavericks played earlier in the day.