Gerunds are a funny subject that keep raising their ugly little head.
If you have time, try and search through some of the older posts, you will find lots of stuff on gerunds that will possibly be able to help you.
How about: I was walking by the river, when suddenly .........
Here we have it as the past continuous followed by a preposition. (I think)
Student or Learner