A man has been praised for teaching a police officer a lesson after he caught him parking in a disabled bay for over five hours.