If you buy a ticket, you get the miles. It's that simple. Whether you upgrade or not doesn't matter. Why should it ? They still get their revenue.
I upgraded many times and always got the miles for my Y ticket. Sometimes, the system even gives you miles as if you had bought the C ticket....