Australia came from two goals down to claim a famous but controversial 3-2 Women's World Cup victory over Brazil in Group C.