The expression "long shot" comes from gambling, particularly horse racing.
A "long-shot bet" is a a bet which you will probably lose--but if you do win, you win a lot.
For example, if almost everyone thinks a horse will lose, bookmakers are willing to take bets "long odds," like "20:1 against." If you bet $10 and the horse loses, you lose your $10. However, if by some miracle the horse does win, you win twenty times your bet, or $200.
Because you are almost certain to lose, it is a high-risk situation. However, if you are willing to take the risk, the risk may be justified by the possibility of a very high reward.