I'm assuming it means something like "well look who it is". Can anyone explain to me the grammatical function of "t'y" here?
The meaning is simply "Who is it ?" (Qui c'est ? formally: Qui est-ce ?) and y is here a short for il (he):
Qui c'est-t-il ?
This is an outdated, colloquial way of asking nowadays only used for humorous effects but possibly also a regionalism.
Qui est-ce? Parisian slang (old )