Hi,
I believe 'a wild hair' refers to a hair that irritates you because it grows in an awkward (and often an intimate
) place, and sometimes in the wrong direction, ie a direction opposite to that of any other hairs that are present. Such a hair is irritating. And thus, the term usually refers figuratively to 'something that irritates you, somthing that is a nuisance'.
eg an employee who always asks stupid and annoying questions in meetings could be called 'a wild hair'.
Best wishes, Clive