A second crack?
Solution 1:
According to Etymonline, the first attested use is from 1830, and it comes from the act of firing a gun:
crack Meaning "try, attempt" first attested 1830, nautical, probably a hunting metaphor, from slang sense of "fire a gun."
The citation is from Davy Crockett, a famous American frontiersman of the early 19th century:
At their head, apart from the rest, was a black bull, who appeared to be their leader; he came roaring along, his tail straight an end, and at times tossing up the earth with his horns. I never felt such a desire to have a crack at any thing in all my life. He drew nigh the place where I was standing; I raised my beautiful Betsey to my shoulder, took deliberate aim, blazed away, and he roared, and suddenly stopped. ["A Narrative of the Life of David Crockett, Written by Himself," Philadelphia, 1834]
Solution 2:
It does appear that "crack" refers to a gunshot, and therefore "to have a crack at" means to have a shot at.
In "The Pilot" by James Fenimore Cooper, published in 1824, we find the sentence:
No, no; not a trigger will I pull in my own regiment about the silly affair; but I'll have a crack at some marine in very revenge; for that is no more than reasonable.
The phrase "to have a crack at" in a more general form appears in a few works of the early 19th Century.
In "The Itinerant" Vol VI, by Samuel William Ryley, published in 1817, comes the excerpt:
"I must have a crack at his nap. Where does the scoundrel live"
In "Randolph" by John Neal, published in 1823, comes the excerpt:
all agreed to "have a crack at him", as they express it here.
In "Epistle to Miss C____" in "Poems on various subjects" by Andrew McNight, published 1799, is the line:
Before they get a crack at you, ten thousand things they'll gar you trow
("gar you trow" means "make you believe")
To back up the concept of "crack" meaning gunshot, there are several references prior to 1830.
On 4th January 1785, Major Edward Williams of the Royal Artillery (in Québec) recorded the result of an experiment with an artillery shell with the words below. The letter was recorded in Dodsley' Annual Register volume 32, printed in 1793:
The shell gave a sudden crack at a quarter after nine.
In the Urquhart and Motteux translation of Francis Rabelais' Book 1, published 1693 and 1694, in the chapter "The Games of Gargantua" a list of games played is provided, which includes:
At gunshot crack
Interestingly, the original French is "petarrades", which means "farting" according to a 1717 English Dictionary.
There are others, but I think 1694 is an early enough citation of "crack" in terms of gunshot. I've not been able to establish as yet whether this line was included in the original Urquhart translation of the mid-17th century, or if it was part of Motteux's later addition. Given that it is in Book 1, I suspect the former, but had no proof as yet.