Personally I would take an e39 540 ! I have always wanted an M5, but as others have mentioned they are expensive to fix, not to mention few and far between.
As a poor starving student I could also probably buy a 6-year newer 540 for less than an older M5.
Now when I am ridiculously rich I will have a both an e28 and an e34 M5 (+ e30 / e36 M3s) in the garage and an M2 as a daily driver!