AHCI/IDE Mode on HP ELitebook

My HP Elitebook 8440p got switched from AHCI to IDE mode in the BIOS last week without my knowing, and it no longer booted. I re-installed the whole damn Windows 7 and it happened again a week later. I now know how to repair without re-installing, but geez what a weird thing to happen. I can only assume it blipped due to a fault, power surge, faulty CMOS battery or something like that.

You can switch between AHCI and IDE modes if you first change these registry keys to 0:-