Gate agents can not "sell" upgrades. They can offer you a standby upgrade and swipe your credit card. Your card is only charged if you are given an upgraded seat.
Passengers standing by for a paid upgrade will clear only after all medallion upgrades are completed. Unless that specific agent purposely cleared the list out of order the first class cabin was probably already full. Do you know for a fact that those passengers were given first class seats?
The only way a non medallion can buy an upgrade at the gate and go before a medallion is to pay the fare difference for a first class ticket.