I don't know much about the signs of a hamster being scared, but generally, what I've learned is that when hamsters feel threatened or startled, they will stay very still, not moving at all. My Winnie does this when she hears a sound she doesn't recognise.
I have dogs and cats in my house and I keep them well away from the room that Winnie is in, the cats for obvious reasons (I even have a lock on my door because my cats can open them!) but I imagine a dog would be a very scary thing for a hamster, so boisterous and often loud. I don't know much about it, that's just what I assume.
As far as I know I think terriers are hunting/mousing dogs? So I would be especially careful . Hope this helps somewhat
and sorry if I said something you already know