Matvei Gridin had a goal and an assist, and Jonathan Huberdeau, Connor Zary and Ryan Lomberg scored for the Flames (23-27-6), who have alternated wins and losses for the past four games. MacKenzie Weegar, Nazem Kadri and Zach Whitecloud each had two assists, and Cooley had an assist.
Leon Draisaitl scored twice and Kasperi Kapanen had a goal for the Oilers (28-22-8), who have lost three straight, including 5-2 to the Toronto Maple Leafs on Tuesday. Tristan Jarry made 21 saves.
Huberdeau opened the scoring with a power-play goal at 3:12 of the first period. Weegar fed a pass to Huberdeau in the right face-off circle, where he beat Jary to the far side with a snap shot.
Draisaitl tied it 1-1 on the power play at 5:14, skating in from the bottom of the left circle and roofing a shot over Cooley's right shoulder.
Gridin put the Flames back up 2-1 at 14:44 with a power-play goal. Weegar sent a stretch pass to Gridin, who collected the puck off his skate to his stick, skated into the offensive zone and beat Jarry's blocker with a snap shot from the left circle.
Zary pushed the lead to 3-1 at 11:43 of the second period. Whitecloud's one-timer from the blue line deflected in off Zary, who was set up at the front of the net.
Draisaitl cut the deficit to 3-2 with his second power-play goal at 18:26. He one-timed a pass from Bouchard from a sharp angle along the goal line to the right of the net past a lunging Cooley.
Kapanen tied it 3-3 at 4:17 of the third period when his wrist shot from above the right circle bounced off Cooley's right arm and then his right pad and rolled into the net.
Lomberg gave the Flames a 4-3 lead at 6:44. He kicked a bouncing puck on net and tapped his own rebound past Jary's right skate from in front.