Heard on MSNBC by Matt Miller, a former spokesperson for the Justice Department. He was talking about Rudy Giuliani and his off the cuff (“shoots off the cuff?”) remarks in interviews. This is a triple congruent conflation of “off the top of one’s head”, “pluck (something) out of thin air”, and “pull (something) out of a hat”, all meaning a random thought. “Head” and “hat” get confused a lot and that’s what appears to have happened here. As you know, the usual thing pulled out of a hat is a rabbit. As “my ol’ pal” notes, tThe more usual metaphor nowadays is “pull things out of his ass” (making things up) which is probably closer to the meaning of what Matt Miller was trying to convey about Giuliani. For obvious reasons he probably substituted “head” for “ass” at the last second. Thus the birth of this malaphor.