It sounds like you have a fuel delivery issue. When was the fuel filter last changed? See item #2 in the link.
http://www.realoem.com/bmw/enUS/showparts?id=AX71-EUR-01-2001-E46-BMW-320d&diagId=13_0650
http://www.realoem.com/bmw/enUS/showparts?id=AX71-EUR-01-2001-E46-BMW-320d&diagId=13_0650