There is no basis for what has been said to you. If you become pure [i.e., your period ends] before dawn on the fifth day, then you must fast, whether you do ghusl or not, because tahaarah (being pure) is not a condition for the fast to be valid. But you have to do ghusl in order to pray on time, and it is not permissible for you to delay it until before Maghrib.
Whoever becomes pure before Fajr, her fast is valid. And she has to do ghusl in order to pray Fajr on time. If she delays the prayer until the time is over, then she is committing a grave sin, because Allaah says (interpretation of the meaning):
“Then, there has succeeded them a posterity who have given up As-Salaat (the prayers) [i.e. made their Salaat (prayers) to be lost, either by not offering them or by not offering them perfectly or by not offering them in their proper fixed times] and have followed lusts. So they will be thrown in Hell.
Except those who repent and believe (in the Oneness of Allaah and His Messenger Muhammad), and work righteousness. Such will enter Paradise and they will not be wronged in aught”
So what you have to do is to repent to Allaah for delaying your prayers until the time was over, and resolve not to do that ever again.
2 – If you became pure on the fifth day and fasted that day, then you saw blood after praying ‘Isha’, then your fast is valid. Even if the blood had come a minute after Maghrib, your fast would still be valid. But if you became pure during the fifth day, then that day’s fast is not valid, and you have to make up that day.
What was said to you about not becoming pure until after the seventh day is false and has no basis. It is not permissible for anyone to speak of (the rulings of) Allaah without knowledge. The menstrual cycle varies from one woman to another. For some women the period lasts for seven days, for some it is five. Each woman should act according to her own cycle. If a woman’s period normally lasts for seven days, and she becomes pure before that, then she should pray and fast according to the more correct of the two scholarly opinions.
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) was asked a similar question to yours, and replied:
If the menstruating woman becomes pure before dawn, even if it is one minute before, but she is certain that she is pure, and that is during Ramadaan, then she must fast, and her fast on that day will be valid and she does not have to make it up, because she fasted when she was pure; and even if she does not do ghusl until after dawn has come, that does not matter. Similarly if a man is junub (in a state of impurity) following intercourse or a wet dream, and he eats suhoor and does not do ghusl until after dawn has come, his fast is still valid.
I would also like to take this opportunity to point out another notion that some women have: If a woman’s period comes and she has fasted that day, some women think that if their period comes after iftaar (breaking the fast) and before ‘Isha’, this invalidates that day’s fast. There is no basis for that, rather even if the period comes a moment after Maghrib, the fast is still valid.
From Fataawa Ramadaan, p. 345.
And Allaah knows best.