here's how it's done for the W123. Note : the headlights are E-Code H4/H3.
Unplug the connector
Push the locking ring gently until the spring compresses
Rotate the locking ring counter clockwise making sure that the bulb doesn't fall and break into a million pieces.
2008 BMW 335i Coupe