It was Ehlers’ first hat trick with Carolina after signing a six-year contract as a free agent on July 3.
Taylor Hall scored twice, and Mark Jankowski had a goal and two assists for the Hurricanes (29-15-4), who are 5-1-1 in their past seven. Andrei Svechnikov and Alexander Nikishin each had a goal and an assist, and Brandon Bussi made 16 saves.
The Hurricanes scored four power-play goals.
Uvis Balinskis scored for the Panthers (24-19-3), who had won two in a row. Sergei Bobrovsky made 26 saves.
Ehlers put the Hurricanes up 1-0 at 18:35 of the first period. Jordan Staal held off Florida defenseman Gustav Forsling in the right corner before passing to Ehlers, who drove between the circles and scored on a snap shot.
Balinskis one-timed a shot near the top of the right circle to tie it 1-1 at 1:19 of the second period. The defenseman signed a two-year contract with Florida earlier on Friday.
The Hurricanes took a 2-1 lead at 13:10. Jankowski won a face-off and skated to the net, where he scored on a backhand tap-in off the rebound of Nikishin’s shot.
Nikishin put Carolina up 3-1 with a power-play goal at 16:28, scoring on a one-timer off a pass from Sebastian Aho.
Svechnikov extended the lead with a power-play goal to 4-1 at 4:08 of the third period. Seth Jarvis made a touch pass from the goal line to Svechninkov at the left hash marks for a snap shot inside the right post.
The Hurricanes made it 5-1 at 11:17 on a 5-on-3 power play. Ehlers took a diagonal pass from Jarvis and scored short side.
Logan Stankoven passed to Hall for a net-front redirection for another power-play goal for a 6-1 lead at 11:38.
Ehlers completed his sixth NHL hat trick on a one-timer in the right circle off a pass from Stankoven to make it 7-1 at 13:03.
Hall scored blocker side at the top of the crease to make it 8-1 at 18:23, and Eric Robinson scored on a short breakaway at 18:35 remaining for the 9-1 final.