Y and thorn (which has its own character: capital Þ and lower case þ) were always two distinct letters, dating back to Old English (where long and short “Y” were roughly equivalent to long and short German ü, respectively). The sound we associate most with “Y” today originated in the sound of Old English “G” preceding a letter “E” (IE, in the Old English word gesiþ was pronounced yes-ith). By the 1400s thorn was largely considered archaic in English and was generally replaced with the digraph “TH.”
The use of “Y” in place of Þ/þ and “TH” mainly occurred in print, because the typesets imported from Germany and Italy for use in printing presses didn’t posses a letter for thorn. However even in this case that was rare because (as I noted above) thorn as a letter had largely been replaced by the “TH” digraph by this time anyway. There were only certain cases where thorn was still written (namely some abbreviations) and therefore would be substituted with “Y” when printed on a printing press. Unfortunately, the most common word which still utilized thorn was the abbreviated form of “the,” which is the source of “ye olde annoying butchered Middle English” which pop culture clings to and WILL NOT LET GO.
TL;DR - Y and Thorn were NEVER the same letter, just a cheap and lazy substitution by typesetters who didn’t want to shell out the cash to make a proper letter for their printing presses.