In Davey Jones' Locker, we see Jack battling with himself, perhaps trying to stay sane, or just simply having fallen victim to the madness already.
However, after jumping off the Back Pearl, he finds a rock. He interacts with the rock a bit, throwing it, only to find it promptly return, then eventually picks it up, and licks it.
We soon discover that the rock(s) are actually crabs, (which we know are linked to Calypso), and are Jack's ticket out of The Locker.
Jack is a smart man, in almost every aspect when it comes to the sea, especially when it comes to how things work with the monsters and magicks, so was there something going on in his head to realize that the rocks were not part of his "torment" in The Locker?