Once the sale is made - the shares are the purchasers, not the former owner or the brokerage.
The money changes hands via the brokerage middlemen, and the paperwork takes 3 days to be finalized.
You only get into trouble if you then again try to sell the 'new' shares before the 3-day window closes, and use the proceeds to try and buy something else.