Meaning
Perplexed; unable to think what to do.
Origin
From the Bible, Psalms 107:27 (King James Version):
They reel to and fro, and stagger like a drunken man, and are at their wits' end.