You ask:
Was she expecting a miracle? Was it just a random, instinctive motion of a desperate person? What's the lesson?
According to the Midrash HaGadol (Bereishis 23:1) (see bottom of the right column) you can possibly suggest that she was fully aware that she had an important role in raising the redeemer of the Jewish people and so this was her feasibly her ensuring that this came to fruition.
It reads there:
ותקם בעוד לילה - זו בתיה בת פרעה שראתה ברוח הקודש שעתיד מושיען שלישראל להתגדל על ידיה והיתה משכמת ומערבת היא ונערותיה להטייל על היאור וכיון שבא משה לידה נתן לה הקב"ה מה שביקשה ושמחה הרבה
"She rises while it is still night" - This is Bisya the daughter of Pharoah that saw with Divine Inspiration that the future redeemer of Israel would be raised by her, and so her and her maidservants would walk by the River (Nile) every morning and evening. And when Moshe came her way, Hashem gave her what she sought, and she rejoiced greatly.