As a beginner I've learned the standard, stock phrase for "thank you" is arigatou gozaimasu. But having watched a few Japanese movies and TV broadcasts, I've come across a number of other phrases being used to mean "thank you" that I don't entirely understand, so I was hoping somebody would be able to explain.
Arigatou gozaimashita (i.e. the past tense) seems to be used much more often than the present-tense standard phrase, as least in the material that I've been watching. I have a feeling that the choice of tense depends on the whether the thing for which thanks are being expressed has finished or is still in progress. So, for example, at the end of a TV interview the past-tense phrase is used because the interview has finished.
Sumimasen seems to be used fairly often to mean "thank you" rather than "excuse me". It seems to be used when the person being spoken to has definitely got the upper hand in the social situation. So, for example, the candidate at a job interview will say "sumimasen" after being invited to take a seat.
Onegaishimasu seems to be used occasionally to mean "thank you" rather than "please". This one puzzles me because I can't quite see how "please" becomes "thank you". If I had to guess, I imagine it might be appropriate when you thank someone for what they intend to do but haven't actually done yet. So, for example, someone might say "I will get you one when I go to the supermarket tomorrow" and in English you'd say "thank you" but logically you could also say "oh, yes please".
All my attempted explanations are guesswork based on context and might be completely wrong. I'd appreciate it if anyone could provide better or more knowledgeable explanations.