You question does not make much sense. Let's call the ex-boyfriend A and the other guy B. Are you saying this?
You and A broke up. You had sex with B. Two weeks after having sex with B you found out you were four weeks pregnant.
If that is what you are saying, then you were two weeks pregnant already when you had sex with B. So A is the father. Normally I wouldn't be so sure but ultrasounds done withing the first trimester are very accurate.