Nightcrawler has a point about the production date, read the thread in the attached link in more detail, but also keep in mind that there may also be a wiring issue as well. If there is wiring issue near the portion that connects to the temp sender, changing the stat may cause the wiring to be relocated/moved slightly. I believe the temp will drop fully low if the connector is disconnected?? I have not verified this, if this is true, then a short on the same wire will probably cause the gauge to peg. The problem with the DME issue, is it will require dealer involvement and may involve a lot of expense for dealer labor and you may come out with no change?? Depends if the dealer is good and can tell you if there is a record of this reflash being done before. Hell the car is 10 years old, would be unusual that the problem has never been addressed??
http://www.m5board.com/vbulletin/e3...133090-cooler-temperature-gauge-goes-max.html
Seems there may be a DME reflash that may fix some of the temp problems, I see fan failures as well, but this will probably only show up in warmer temps during stop and go driving, and then there was the mother of all wiring problems in the above thread.
Again, you car probably needs a stat anyway, most M5 do, these stats fail all the time, but they do not typically fail closed, they fare designed ail in the open position.
If it were my car, as I have had to do a stat anyway, I would consider changing the temp sensor as it is very easy and relatively cheap (around $30 as I recall if you shop it around) then check the fan for proper function and watch the temps with the OBC, menu #7, as I now have this memorized after watching my temps due to a bad stat.
Good luck and hopefully you will get your issue resolved quickly and easily.