Offside calls are dependent on whether the player has any effect on the play. The ref must have decided that Kerr being in an offside position had no effect on the events. Probably correct call because the ball went off the brazilian player before it reached Kerr and she could not have had any play on the ball.
Well - to take the other side, the defender only headed the ball because she was marking Kerr - who was in an off-side position (or had come from an off-side position). That's pretty clear 'influencing play'.
Like all rules, once you step away from black-and-white (or was it over the line or not), whatever interpretation is applied going to upset a proportion of fans.