My theory is you should tell your friend to just give it to me for a while and I'll spend the weekend (maybe more) trying to figure it out
Take it to the dealer and see if they'd be willing to check/reset the software. I thought the M5 was limited to 155 like the E46 M3?