Racing? You mean autocross or time trial? For these purposes, I would guess the 3 series would be a better choice. Weight to power ratio is important. The 3 series (in my opinion) is more nimble where the 5 series is more a high speed cruiser (though the 540 is very fast from a standstill). However, in cornering a fully suspensioned 3 series can probably out maneuver the 5 in a tight course such as an autocross.
Just my opinion (no flames please).