Originally Posted by
YumYumcake
The upgrade does not change the underlying booked fare, which is what determines mileage accrual.
This is not completely correct. Sometimes, the upgrade is a change-fee-free buy up to a discount first class fare. In this case, you'll get a new ticket number that shows the total price paid and your new fare class. In other cases, you're switching to an -UP fare, which may or may not get the bonus depending on what the underlying fare class is.
It's complicated, and there is more discussion
here.