Common issue, with arcing damage to the tail light fitting itself. This is due to poor lamp holder connections.
There's a LOT of info on this forum (and on the net in general) on how to address this. One easy fix is to remove the tail fitting from the car, repair the damage to the fitting and then add solder tot eh fitting (where the arcing was) AND to the tabs on the lamp holders. This has worked for me.
You may need to address the mounting of the metal conductors in the tail fitting, as heat may have compromised the lamp holder tension - leading to further problems.
Fix both sides.
*edit* good info here...
https://xoutpost.com/bmw-sav-forums/...ion-fix-5.html