in spite of yourself

(do something) in ˈspite of yourself

(do something) even though you do not want or expect to: He was a bit depressed so I tried to cheer him up with a joke. He smiled in spite of himself.
See also: of, spite