If you were told at the paydesk that you couldn't have the item you'd chosen because it had been sold earlier over the phone where do you stand? (apart from emptyhanded :-) ).
Shops don't have to sell you anything. They have goods to sell but your application to buy them needs their acceptance before any legal contract exists. See 'Offer and Acceptance' in English Law for definition. It is called 'an invitation to treat' and you are right, it leaves you empty handed.