As has been noted before, it has been used by Shakespeare.
A qualified guess is that the phrase, (and the hand gesture that accompanies it), symbolizes oral sex,
and implies that the insulted is gay.
Shakespeare - "Romeo and Juliet"
Buy a
I bite my thumb at thou!
mug!