Yes stay away from 2002-2005.
Either go retro E38 or 750Li.
I had three friends with brand new 745Li and 760Li both were junk. Electrical and software issues galore, sercurity system problems TPMS problems, loads of maintenance off warranty engine problems... it goes on.
My 740i Sport was far less headaches and I let them know it haha.