A share of stock is itself a set of contractual rights, but the record owner has a property right in the share (and often a physical certificate). It doesn't matter if someone takes your share or inadvertently/accidentally sells it to an innocent buyer. It's still yours and you have a better claim to it than any buyer or later holder.
But a beneficial owner of a share held in "street name" has only a contractual right to his shares--essentially a promise from his broker that the broker will have at least [x] shares for him (note this means he does not have a claim to any specific or identifiable shares and his broker surely holds many times more since they'll have many other clients). And on top of that, his broker has an account with DTC that involves a second layer of contractual rights to the stock--essentially a promise from DTC to the broker that DTC will have at least [x] shares for the broker (again not specific or identifiable shares and DTC certainly has many times more shares since DTC holds nearly all shares held in "street name")
If your broker or DTC accidentally or inadvertently disposes of too many shares (and this can happen surprisingly often) you only have recourse against your broker or DTC. The agreements between [you and your broker] and [your broker and DTC] do not bind the new owner of the shares, who has no obligation under those agreements and, as a bona fide buyer + current holder, also has a better claim to the shares than you do.
If that wasn't specific enough, here's a very detailed summary and analysis of the current stock ownership structure and mechanics: