It’s yet another of these hand-waving terms for a thing that’s too unimportant to have a name of its own, or whose name you have for the moment forgotten. In this case, it refers to some unspecified object or small device, especially a mechanical one. An example is in The Tommyknockers by Stephen King (1987): “You’re almost done with this part. Just solder that red wire to that point to the left of the long doohickey.”
The best guess we can make is that it began life as US Navy slang in the early twentieth century. The first recorded example appeared in the magazine Our Navy in November 1914: “We were compelled to christen articles beyond our ken with such names as ‘do-hickeys’, ‘gadgets’ and ‘gilguys’.”
There is some doubt where doohickey comes from, though the authorities mostly point to its being a blend of doodad (at first a trivial or superfluous ornament, known from slightly earlier) and hickey, which now is more usually a pimple or a love bite but which at the beginning of the twentieth century could be an odd person or something of little consequence.
Incidentally, the Sailors’ Word-Book of 1867 says a gilguy is “A guy for tricing up, or bearing a boom or derrick. Often applied to inefficient guys.” Most of us know at least one inefficient guy, so perhaps we could employ it as a subtle insult. However, gilguy is still in use in sailing circles for a gadget, or to refer to a line used as a temporary guy.