One of the first patterns a learner of the Japanese language will come across is:
〜したことがある
(I) have 〜 before.
わたしは中国を3回訪れたことがあります
I have visited China three times before.
However, I also occasionally come across sentences like:
以前に一度会ったことがあった。
以前、6人がかりで、注射をいやがる私を取り抑えなくてはならなかったことがありました。
With the former, they seem to be interchangeable, but the latter was originally a sentence that I wrote, but had 「あります」 changed to 「ありました」, though among other things.
However, I also came across the following similar sentence.
以前も組織の男で40人で取り押さえねばならんほどの大騒動になった事がある。
What is the difference between these two patterns?
More concretely, what would be the difference between the following two sentences?
以前に一度会ったことがあった。
以前に一度会ったことがある。
Edit
I would also appreciate an explanation as to why the following sentence is valid.
仕事で大阪に引っ越す前、大阪を訪れたことが1度だけある。