Sounds like you've got the first of the cold-start symptoms of VANOS seals going bad. The rough running will be followed by an oscillating idle until the car is warm and off-idle stumbling if the seals are allowed to go. Some M54s (the 3.0, mostly) also develop a rattle. BMW has developed a software "fix," but it apparently just reduces the sensitivity of the idle-control system to input from the VANOS sensors, masking the problem rather than resolving it.
There's been a lot of discussion about this issue, and as far as I know no one has been able to pin down the exact reason why VANOS seal degradation causes these cold-start problems, but I can tell you there are a lot of people who've had some form of the problem and resolved it by changing the seals, myself included. The performance benefits are a nice bonus, especially at low (<4000) RPM.
You've got a single VANOS, which means you need some special tools to complete the repair. Beyond that, it's about a four-hour job and pretty straight-forward. Seals are $60 or so from Beisan Systems. Good time to do all sorts of other maintenance while you're in there.