I haven't paid attention to how new Opera handles it, but in old Opera (Opera 12), there were 2 different states for each setting: default and user-modified.
When a setting wasn't in the preference file, that told Opera to use the default value for the setting (which was hard-coded) . Then, if a user modified the value for a setting (even if they changed the value back to match the default), the setting was present in the preference file to show that the user had messed with setting.
On upgrade to a newer version when Opera changed the default value for a setting, if you never messed with the setting, you'd get the new default. But, if you had previously messed with the setting, even if you reverted back to match the default value, your setting would be honored/kept on upgrade.
I think that worked out pretty good and Opera should do that now when possible if it doesn't. It of course won't help with wallpapers and themes if old ones are replaced instead of just adding new ones that are the default.