In poker parlance, the phrase "a nut hand" or "the nuts" refers to having the best possible -- and hence unbeatable -- hand in a given situation, mainly in community games. For example, if you have the ace and six of diamonds and the flop comes jack, 9, and 3 of diamonds, followed by a 4 and 7 of different suites, you have the nut flush and can't be beaten, even if your opponent has the king and queen of diamonds.
While the concept is straightforward enough, the origin of the term is one of those typically nebulous areas that's lost in the mists of time. It almost certainly originated from the historical poker games of the Wild West days and the most common theories we've read revolve around versions of the explanation you cite, namely that if a player had bet everything he possessed, his last move would be to place the nuts that held his wagon wheels to their axles on the table to ensure that, should he lose, he'd be unable to flee and would have to make good on the bet. Since he'd be unlikely to bet what probably amounted to his most valuable possession unless he thought he was onto a sure thing, the folklore says that this is how the best possible hand -- the only one he'd risk his wagon on -- came to be known as "the nuts."
We can imagine scenarios where it might not be the owner of the wagon who volunteered to remove the nuts, but rather one or more oppenents who were beginning to doubt that his pockets were as deep as he was indicating and wanting to get some collateral up front.
It reminds us, albeit tangentially, of a story that legendary poker player and notorious hustler Puggy Pearson used to relate, about how he'd deliberately stash his bankroll under one of the wheels of his car when arriving to play an illegal poker game somewhere, just as a precaution, should some unscrupulous oppenent try to rob him of his money (or take back what he'd fleeced them for.)