From ALC:
http://home.alc.co.jp/db/owa/jpn_npa?stage=2&sn=189
--
"Arigatou gozaimashita" is the polite form of "aritakatta", a past tense expression that means "was difficult to bear".
Although it is also possible to use "arigatou gozaimasu" with reference to past events, it is, of course, much more natural to use the past tense "gozaimashita" form.
As a general rule, "arigatou gozaimashita" is used to thank people for their past actions, whereas "arigatou gozaimasu" is used to thank someone for an action that directly preceded the use of the expression.
Consider the following two expressions, both of which mean "thank you for coming all this way":
わざわざお越しいただきましてありがとうございます。
わざわざお越しいただきましてありがとうございました。
The first, which uses "gozaimasu", would be said to the listener as soon as he/she arrived from afar. The latter expression is more likely to be used when some time has passed since the listener arrived (i.e. a few hours later, when the business between speaker and listener has been concluded.)
However, there are cases where "arigatou gozaimasu" is sometimes used in situations where one would normally expect to hear "arigatou gozaimashita". Usage of "arigatou gozaimasu" to thank someone for events that occurred entirely in the past springs from a realization that use of the past tense could indicate that "I was grateful [but now I'm not]", whereas use of the present tense indicates that "I was, and am still, grateful".