My previous car was a E46 M3. It's the better drivers car, by far. Out of the many cars i've owned i'd say this ranks up there with my old S2000 for best drivers car. But the E46 3 series was plagued with many flaws that could occur at any time and cost you thousands. Search E46 M3 VANOS, Exhaust Hub, SMG Pump, Window Regulator, Subframe tear, Guibo, Trailing arm bushings, etc. If you can fine a low mileage and well maintained E46 M3, get that. A rule of thumb is don't buy the cheapest E46 M3 available because that could eventually end up being the most expensive one.
The E9x 335i is a great car if you want straight line acceleration. Though it feels like driving a Toyota Camry after driving a M3 for a while. $1500 in mods and you get 400+ hp to the wheels. With that you would destroy any E46 and E9x M3 in a straight line. The major flaws to the E9x 335i is the High Pressure Fuel Pump and Turbo Wastegate rattle. Those are very expensive to repair but fortunately now they are covered under an extended warranty so its a free fix for you. General consensus is that the E9x 335 is a much more reliable car.