There is zero evidence that AS did this intentionally because someone showed up and offered more.
OP is due a refund of the fare difference and then a customer service gesture for his troubles. The refund should be to his form of payment, e.g. CC.
The AS system is customer-unfriendly. Where you are assigned should not make any difference. The UA system downgrades based on reverse upgrade priority. Thus, no paid ticket would be downgraded ahead of any form of UG.