It means that the person had the moral strength, courage, or lack of common sense to do something which is usually considered wrong or which the speaker considers wrong.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.