At the gate (DM), its about status and fare paid (then miles flown). So any GS or 1K with a higher fare class will jump ahead of you. Previously cleared segments do not influence UG priority at all.
I disagree with the fact that an upgrade on a previous segment should count as a rating factor. If we are both 1Ks, and I spent 2X on my ticket than you, why should I be further down the waitlist for an upgrade because you started your trip one airport ahead of me?