A starter that only lasts 3 innings isn't eligible for the win. Have to go at least 5 complete innings. If his team had the lead the whole time the official score keeper uses his judgement on who deserves the win. In your example whoever pitched the top of the 10th (assuming we're talking about the home team here) would be awarded the W.