In the 1800s, the word 'shot' was of course associated with guns and shooting, but it also had the meaning of 'a small chance of success' or 'giving something a try.' For example, in the Wellsville Daily Reporter, 1881, it reads:
"The Little Genysee well on the Matthew Green farm has come to a stop. It had sixty feet of sand . . . the tools are still hanging in the well and the owners are undecided whether or not to give it a shot."
The phrase began being used in a metaphorical way since at least the 1880s from what I can tell. For instance, in 1883 in the South Australian Register, in reads:
"No doubt every estimate made at the time was a shot in the dark, but it would appear from the result of the first tendering that Mr. Morgan's guess of $(?)250,000 was rather under than over the mark."
* I am not very strong physically, so it was a shot in the dark when I decided to challenge someone at the gym to a weight-lifting game.
Phrases and Idioms
knowyourphrase.com - Meanings and Origins of Phrases and Idioms
Note: Imagine being blindfolded and you had to find a small coin that was located somewhere in the state of Ohio in a single week! Do you think that's doable? Probably not, that sounds impossible! Similarly, finding the origins for many phrases is like that too; impossible. The origins that you read or hear about are typically the common theories most people agree on to how it originated, but it may or may not be the case. Also, this does not apply to all phrases, just many of them.
Keep this in mind as well: The quotes I post are usually taken from newspapers or books that were written centuries ago. However, these old quotes are only to serve as an indication for how old a phrase could potentially be, and are not meant to be taken as if the phrase originated from that very source. In all likelihood, if a phrase is being quoted in a newspaper that was printed in 1838, then it's probably already a common phrase known to the people of that time, which would make it even older.
Find the meanings for more phrases and learn where they may have come from at Know Your Phrase!.