St. Louis took a 1-0 lead at 6:59 of the first period when Oskar Sundqvist tipped Dunn's snap shot.
Carolina answered 41 seconds later on a one-timer by Justin Williams from the top of the left circle to tie it 1-1 at 7:40.
"[Williams] keeps doing it," Hurricanes coach Rod Brind'Amour said of the forward, who is tied with Teravainen for second on Carolina with 18 goals, behind Aho (26). "Momentum kind of went back the other way. He just finds a way."
Justin Faulk's long wrist shot under the crossbar gave the Hurricanes a 2-1 lead at 10:44.
Dunn's wrist shot from the right point through traffic tied it 2-2 at 2:13 of the second period.
Aho put the Hurricanes ahead 3-2 with a shorthanded goal at 13:03. Allen mishandled the puck along the boards after Carolina cleared it, and Aho gathered it to score on a wraparound.
"I saw him going after it, I was pretty close and he mishandled it," Aho said. "It was a lucky bounce, but I'll take those."
Teravainen set up Jordan Staal for a one-timer from the left circle to make it 4-2 at 10:46 of the third period. Staal has five points (one goal, four assists) in three games since missing 32 of 34 games with an upper-body injury.
"It's just exciting to get back and be part of it," Staal said. "Obviously the boys were rolling and I just wanted to help as best as I can."
Andrei Svechnikov scored into an empty net with 1:01 remaining for the 5-2 final.
McElhinney is 6-1-0 in his past seven starts and has allowed two goals or fewer in six of them.
"I think everyone was ready to go from the drop, which was great to see," McElhinney said. "Phenomenal effort, but a couple weird bounces, I think. Other than that, I thought we played a great game."