Lyon moved within a point of the Ligue 1 summit with victory in a madcap game at the Stade Gerland.
Seven different goalscorers, three penalties and two red cards made for an entertaining afternoon for all present, the hosts squandering a two-goal lead before pulling ahead again in the second half.
Maxime Gonalons and Alexandre Lacazette put Lyon in control but Wahbi Khazri and Jerome Rothen pulled Bastia level, the latter with a spot-kick after Dejan Lovren was sent off.
Lisandro Lopez restored Lyon's lead from 12 yards after Fethi Harek was dismissed and Jimmy Briand and Steed Malbranque scored in stoppage time, the latter from the spot, to give the scoreline a misleadingly one-sided look.
Lyon's Yoann Gourcuff had also hit the crossbar in first-half stoppage time as the action never let up.
Gourcuff's free-kick got the ball rolling in the fifth minute, Lovren meeting his delivery with a six-yard header and although keeper Macedo Novaes saved, Gonalons was able to score the follow-up.
Lacazette was denied after a link-up with Gourcuff, who then drew another sharp save from Novaes. Anthony Modeste and Khazri were both denied in Bastia's first attack but Lyon doubled their lead when Lacazette started and finished a superb move in the 25th minute.
Bastia responded within two minutes, Lovren unwittingly deflecting the ball into the path of Khazri, who finished emphatically. And the Croatia defender's day got worse four minutes after that when he was red-carded for a tackle from behind on Florian Thauvin, Rothen converting the resulting penalty to level the scores.
Gourcuff, playing his first league game since returning from a long-term knee injury, volleyed against the bar before the interval after Bafetimbi Gomis flicked on Anthony Reveillere's cross.
Bastia threatened at the start of the second half when Bakari Kone blocked Khazri's shot and Remi Vercoutre saved Modeste's follow-up. But Lyon led again after 55 minutes. Harek fouled Malbranque, injured himself
in the process and collected a second booking for the offence before, after a long delay, Lisandro fired home the penalty.
Novaes saved at the feet of Gourcuff to keep the game alive but with the visitors chasing an equaliser, Lyon took advantage in injury time.
First Malbranque set up Briand for the fourth goal, following good work by Gourcuff and Gueida Fofana, and then the former Fulham and Sunderland midfielder scored his first goal since returning to Ligue 1. Sambou Yatabare brought down the impressive Gourcuff and Malbranque scored the penalty.