I believe that the phrase has its origins in fox-hunting. When the fox gives up the chase it seeks refuge in its earth. In truth, it is then cornered and the hunt is soon over!
Gosh, you were up and about early this morning crofter!!
I was aware of the phrase but a little thrown by the word "discover" in the clue ........... best wishes S.