In the UK, for instance, terminating someone for reporting sexual harassment is a very good way of losing a lot of money at a subsequent Employee Tribunal and getting your company fined. There's a lot of great precedent for siding with the reporter, even if other flimsy reasons are given for their termination.
However, the point made is a correct one. An HR person has a duty not to you but to the company, so never assume they have your best interests at heart.