It's a long thread.
http://forum.e46fanatics.com/showthread.php?t=451510
I did this on my E46. It worked after I synced the key to the car....The correct way.
I followed their directions on how to sync it and it didn't work. It unsynced my good key.
Then I called my buddy who works at BMW and he talked me through it and got them both working in 2 minutes. Works great ever since.
They say to turn the key to position 2, My buddy had me turn it to position 1.
Give it a try. If you run in to problems I can ask him the sequence again.