2nd pinion - it
2nd wheel - yz (because it hase 3 dogs behind to mate with yz 5th wheel)
My own inability to get a YZ125D gearbox to stay in 1st gear rules me out as an form of gearbox guru, but the mix-and-match 2nd gear is a worry...
Ahhh... let me troll some part numbers and I'll see if I can come up with something more useful than the page of "It's possible", "maybe", "you might find" that I was about to type...
Edit: I see your dilemma... For anyone else reading, the 2nd and 3rd gear pinion part numbers are the same YZ ~ IT, but everything else is different.
Based on the part numbers, it sounds like the problem is with the assembly/clearances, rather than incompatible parts.
Everyone says that you should replace gears as a pair, so (in the absence of anyone who actually knows what they're talking about) I'd be looking at fitting a the 2nd gear pinion from the same source as your 2nd gear wheel.
And totally unrelated to your actual problem, what's the change from 4th to 5th like? Small? My parts lists don't show the tooth counts (they do for the earlier bikes), but logic and the part numbers both suggest that a YZ would have a closer 3rd to 4th change, as well as bringing 5th lower...