There are some situations where when conversing with a person, they unexpectedly say something bad about another person and we have no clue to anticipate that this person will actually do ghibat. What can we do in this situation? Is it still ghibat although it was beyond our control?

All what you need to do at this stage is tell the person to stop talking, and if he continued, leave him, and go away.