Gagner, who came into the game with just five goals and 17 assists, totaled four goals and four assists to match the Edmonton record for most points in a game held by Gretzky and Coffey.
With the score tied in the third, the Oilers took a 4-3 lead as a shot by Whitney from the left point went high, but it took an Edmonton bounce as it went to the right side and Gagner buried it 1:54 in.
Less than two minutes later, the Oilers took a 5-3 lead as Cam Barker's off- speed shot from the left point got past the glove of Crawford, who was pulled for Emery after the goal.
Chicago responded two minutes later when Bolland backhanded home a loose puck in the slot, but Gagner completed the hat trick less than 30 seconds after that on a wrister from the right circle off a feed from Hall.
Gagner scored his fourth of the game and ninth of the season with 5:29 left in the contest and assisted on Eberle's goal with 4:45 to play to cap the scoring and break into the Edmonton record book.
The only goal of the first period went to Chicago when Mayers scored his fifth of the year 6:29 in.
Chicago made it 2-0 just 40 seconds into the second as Patrick Kane's pass from the right to the left saw Sharp one-time it between the pads of a sliding Dubnyk.
Edmonton tied the game less than two minutes later as Hall went in on a break and snuck it home. Just five minutes after that, the Oilers tied the game on a wraparound from the left side by Gagner.
The Oilers then took a 3-2 lead on the power play with 7:37 left to play in the second when Whitney's slap shot from the left point went into the right corner of the net.
Chicago, though, tied the contest three minutes later while shorthanded as a 2-on-1 break saw Jonathan Toews blast a shot from the right circle and Sharp bury the rebound from the left side.
Chicago continues its nine-game road trip in Calgary on Friday...Edmonton hosts Detroit on Saturday...Edmonton won three of four against Chicago this season...It was Gagner's second career hat trick.