If we wanted to say "fiyhi" for an unnamed make person in English we would say "In him". Would it still be fiyhi in Arabic?
Well, I guess you can probably find instances of weird use of pronouns in the Qur'an, e.g...
Q. 2:72
فَقُلْنَا ٱضْرِبُوهُ بِبَعْضِهَا
We said: Hit him with a bit of it...Neither this verse nor the preceding one mentions the man who is to be hit, there is only mention of a 'nafs,' a self, in which case the pronoun should be 'ha,' (and not 'hu') as in Q. 4:1, 'khalaqa minha zawjaha.'
But then, in the verse you're talking about, there is no mention of anyone aside from Maryam, and the preceding verses talk about something else entirely, so I don't really know how you could claim that this pronoun is referring to another person. More likely, as is indicated by the fact that the aforementioned verses are all but identical in wording, this use of the masculine is simply a grammatical mistake; a literary anomaly that Allah's spell-check missed.