There is a literary technique in comedies where a person says something intending for it to be reassuring and confident, but their words are humorous because when interpreted differently, the phrase could mean the opposite.
An example: In an adventure story a character Joshua is known for being clumsy and causing accidents. He convinces the captain to take him along on a journey. The captain says, "Okay, but you'll have to keep up, we can't have anyone slowing us down." Joshua says:
"Don't worry captain, with me along that will be the least of your concerns."
As you can see, Joshua meant to say "You shouldn't be concerned about me slowing you down," but he also somewhat implied "I'll cause greater concerns for you than slowing down."
Is this an example of irony? Is there a more specific term for this kind of humor that is accidentally self-deprecating?