Fig. to guess aimlessly; to speculate as to a fact. Am I close, or am I just whistling in the dark? She was whistling in the dark. She has no idea of what's going on.
Summon up courage in a frightening situation, make a show of bravery. For example, They knew they were lost and were just whistling in the dark. This expression alludes to a literal attempt to keep up one's courage. [First half of 1900s]