If you have a discovery which is disabled by default and you remove the override that enabled it, objects that where discovered are not removed. If you run ‘remove-disabledmonitoringobject’ or ‘Remove-SCOMDisabledClassInstance’ (depending on your version of SCOM) the objects remain.
This is a design ‘flaw’. Only objects discovered by natively enabled discoveries are scrubbed by the grooming process. If a discovery is disabled by default any objects it created won’t get purged.
The easiest solution is to create a temporary override for the discovery in which you enforce the disabled setting by setting the enabled-property to false and ticking the ‘enforced’ checkbox. If the override is active you can rerun the PowerShell commands mentioned above to successfully groom the stale objects from the database. After this is done you can remove the override.