Unfortunately, I started to experience tail lamp malfunctions as well in my 08 528xi (out of warranty). 1st it started on the left, then the right affecting all rear lights. I took the car over to my independent bmw mechanic who I've used since my 1st BMW in 02.

Basically, the connections had melted on both lights. I had to replace both light rear bulb carriers as some connection paths were fried as well. I literally saw the melted plastic. According to the mechanic, he'd seen this in almost all 3's but never a 5. He ended up creating an extra ground to prevent the issue from happening again.