I'm going against the grain. If you really want this girl, long run, you've got to NOT be there for her. I'm not even going to back this up with specific instances, since you won't believe them, and the ladies will deny this up and down - but the bare truth is that people want what they can't have.
It will kill you to not be as available to someone who you care about - but you can play the angle to give her good advice, and if she doesn't want to hear it, or keeps saying the same things over and over again about the loser ex boyfriend, then you need to present some tough love. I'm not advocating being a dick, but lay out how you feel about the situation (you can be honest and sensitive here), let her vent for a while, then get the hell outta there - she needs to deal with it on her own, and when she comes to the realization that that guy sucks, she's going to want a solid guy to run to, not some
pussy who she can confide in (that's what her girlfriends are for).
Buck up, I wish you the best of luck brotha.