When to become involved is immediately. This is especially true as you have indicated the young lady has been suicidal in thought in the past.
How to approach will be the main question here. From my place of thinking, putting forward a message to a school guidance counselor and the Principal would be beneficial. There are ways to do so anonymously, which, would keep your daughter separate from this and thus not have her seen as a problem by the former boyfriend of your daughter's friend.
Whatever you do, I urge you to step forward. Far too many young people end their lives regularly, because of matters which start out in this manner.