If a unit successfully Ambushes an enemy unit conducting a Close Assault and causes it to retreat (i.e. via a flag), can the defender advance after the battle into the attacker's hex?
As a matter of consistency, I'd say 'yes'. How is this situation handled?
No. You can only advance when it is your turn. Just because you became active and attacked does not mean you can advance.