A diplomat buys a rank of Ranged (Light) for 5 XP+ 5 extra XP for being a non-career skill. The next time the Diplomat gains XP he purchased the Recruit specialization and buys the ability that makes Ranged (Light) a career skill. Was that 5 XP lost forever because he purchased the rank in the "wrong" order? I've done a few searches and can't find the answer.
Purchased non-career skills that later become career skills?
They are lost. Your GM may make a call to give you a break but generally you don't get a refund for previous expenditures.
Think of it this way:
You buy a movie the day it comes out, and the SRP is $25. A few months later, the SRP drops to $10. You don’t get $15 back from somewhere.
There's no refund of the spent XP, something that Sam clarified very early on in the game's life cycle.
Nytwyng's analogy is spot-on, in that much how you don't get a refund if you buy something at full price when it comes out but it later gets dropped to a lower price.
That said, I've heard and seen instances of GMs providing a refund on the XP spent, but that's a house rule, though far from being any sort of game breaker as the returned XP is usually fairly small (5 to 15 in most instances).