Asleep and had a scary dream. Can this cause irregular heart beat?

For sure! Your heart responds to Adrenalin and a scary dream can pump a lot of it into your circulation. In the most extreme of circumstances, it's actually possible to be "scared to death" - this is the mechanism of so-called "voodoo death" in which a pre-scientific person is so scared of black magic directed against them, that they have a serious arrhythmia and die. Nightmares are usually harmless though.