You've expressed it precisely. Something was in the process of occurring when another event took place. I can't improve upon the grammatical explanation. The best I can do is to give some more examples.
As I was going to St Ives, I met a man with seven wives.
We were just minding our own business, when all hell broke loose.
A very large aftershock began just as I was thinking that the earthquake was over.
I was dreaming of scoring a hat-trick, but it was not to be.
Interested in Language