Thanks, Pluiepoco!
Actually, in English it sounds a little more "kidding" if we don't include the "of"; the meaning is the same, of course,
what are you thinking = what are you thinking of ( = what are you thinking about) but I think the nuance is better here, in this "joking around" context, if we leave out the "of."