To plan to fly two separate, connecting legs on one ticket and in different classes may not be bookable. You can do each WAY in different classes but if you are flying, for example, Houston to LA via Dallas, unless you book Houston to DFW as one ticket and DFW-LAX as another, I don't think you can do it.
An exception to this is if you buy F and one of the flights doesn't offer F so you end up in Y but if both classes are available it's a problem. I
Looks like OP is talking about paid upgrades - maybe that's possible by segment???