that's pretty harsh as its your first trip and entering Visa Exempt. Is your friend Thai? Where did you meet as maybe what your friend said something to immigration that then prompted the IO to advise you need a visa. Anyhow I think you have a warning in the system so best get a visa