It took me month to find that on my test unit, the problem comes from bad default values of the brownout detection...
At 16MHz the chip need voltage, and when it drops below a certain point, the ATMEGA can execute random instructions or flip bit in memory.
By default the brownout voltage is set to 2.7V which is way too low. The only solution is to adjust the value to 4.3V (change high_fuses to 0xDC) and re-burn the bootloader. I did it with the "parallel programmer".
Now I have never had a reset or bad flash again. Maybe this is part of the problem of some people in this thread.
See
Arduino Forum - Request: bootloader options for brownout detection for explanation.
Believe me, this had driven me crazy for months!