Whenever anyone personally asks me about a similar situation, my quick advice is this: after you've dated ten other people.
In a perfect world, that'd be ten each for:
- the ex,
- AND your best friend.
But, make a solid effort yourself, and you'll give the other two time to get over their relationship, and/or reconcile. If you still feel the urge after dating ten other people, you'll have a lot more "supporting evidence" that the ex and you getting together had nothing to do with your BF and the ex breaking up, which is primarily what you're trying to avoid.
The worst thing would be to create a competitive love triangle, and potentially lose both of them.