In response to my previous comment about a "best solution for the next release," there is no way to automatically detect and "fix" when a database has been damaged by mixed file versions without explicitly stipulating how the resulting damage will look, without risk of further data loss. Any automatic detection will raise a false positive during an upgrade from the Lite version, resulting in catastrophic data losses during that upgrade.
We will continue to fix possible causes of damage resulting from mixed file versions or from incomplete uninstall processing if there is a flaw in the related process, but we will not be able to auto-detect and correct the damage itself that results from a random case. Whenever mixed file versions or an incomplete uninstall is the culprit, there must always be a human investigation of the flawed database before a fix can be issued.
Making the change in my previous post should correct the damage that I see in your case.
I have made the appropriate changes to the 4.0.6 upgrade script to detect this particular case and workaround matching damage as of the next release.