Mine has been doing that since I bought it in 2002. This is a known issue with the E46 M3s. Many have had better luck going back to the dealer during the warranty period. Depending on the dealer, they may replace the fuel pump to fix the issue but I've heard of others that still had the problem even with the new pump. I just learned to live with it. How I managed to get around it is by keeping the the key in the "On" position for a few seconds before cranking the motor. That allows the pump to pressurize the fuel lines. So far, so good. My car starts on the first crank every time.
You can also find many other great info on this issue on M3Forum.