I just recreated this scenario by imaging HP to a partition, using Anytime to Upgrade to Ultimate. The only installer version it will then allow to run a Repair Install is Ultimate. However because I don't have an Anytime Upgrade key (I inserted a full retail Ultimate key in Anytime) I cannot test whether it will accept an Anytime key after Repair Install. This is an unresolved issue which you can test if you want to help others.
To run an Ultimate Repair Install, Back up your files and a Win7 Backup Image externally so you can go back. Unlock all versions if necessary in your installer by extracting the ISO from DVD using ImgBurn, run the
ei.cfg removal tool, then burn another DVD with ImgBurn at 4x speed or run the extracted files from the deskstop.
Choose Ultimate version, agree to stay connected to Internet, choose Upgrade install as shown in tutorial.
If it won't allow Anytime Key to activate after Repair Install, you can run another Repair Install which changes version back to Home Premium, by changing the keys shown below to
HOMEPREMIUM for the EditionID and
Windows 7 HOMEPREMIUM for the ProductName, run a Home Premium Upgrade, insert your original HP product key, save an image of HP then Anytime Upgrade to Ultimate with Anytime Key.
How to Use Regedit
If this fails, you can reimage back to Ultimate or clean reinstall Premium to Anytime Upgrade again.
Backup Complete Computer - Create an Image Backup
System Image Recovery