I thought it might be a useful little Thai Bite today to mention something that I have heard quite a lot recently. When a Thai asks a Farang their name, supposing the guys name is 'Andy', I've heard people say something like ผมชื่อคุณแอนดี้ (pʰǒm cʰɯ̂: kʰun ændî:) 'I am Khun Andy'. On the phone 'Andy' might also introduce himself as ผมคุณแอนดี้นะครับ pʰom kʰun ændî ná kʰráp 'I'm Khun Andy' (Andy is just a hypothetical name and has no connection to anyone I might know

As mentioned in other posts, the word คุณ kʰun comes from the Sanskrit word गुण 'guɳa' which in this context you could take to mean 'respect' or 'respected one'.
General rule with using 'คุณ' 'khun' - It's ok (and required) to use it when addressing other people (if no other appropriate pronouns are being used in front of someone's name with the exception of a few circumstances), but it's not a word that you should address yourself with. It creates the feeling that you are putting on airs. It shouldn't be thought of as an equivalent to 'Mr.', 'Ms' or 'Mrs'.