I was in the same situation a few weeks ago! Both cars are amazing, but it comes down to what you personally want (as it has already been said).
The M3 is much more RAW, and that exhaust noise at high revs is unbeatable! Its handling is much better and it generally feels like a 'race' car. I really love the look of the M3. It doesnt look like a normal e46, and has a really mean look to it! The power bulge on the bonnet, and those wide wheel arches create quite a presence!
The 335i on the other hand, is more refined and luxurious. Performance wise they are both very similar (just search youtube: 335i vs M3), but the performance from the twin turbos generate a different experience than the M3 (both equally good, just different). The interior styling is fresher as well. The 335i in my opinion is more subtle in styling in terms of presence and aggression. Very beautiful car, but much more understated than a M3.
If you are young and enjoy driving, I would go for an M3. If you are more conservative and would like to drive a more comfortable and civilized car, go with the 335i. Just my 2 cents as I had the same decision to make....and guess what I choose!?