I'll re-address this scenario once again, before getting any of my peers below angry with me, for giving the listing agent a "benefit of doubt". In your original statement, your words are: "the listing agent would not submit our offer because he said he had his own buyers".
Did you hear this statement directly from the mouth of the listing agent, or from your agent? If, from your agent, did he or she hear such a statement directly from the listing agent's mouth, or POSSIBLY misinterpret something the listing agent said - such as "we already have an accepted offer" which usually means that the property is closed off from "accepting" an additional offer. ( Subsequent offers can be received, just not accepted, which is a huge difference.)
If the listing agent DID make such a statement, they would indeed be not only wrong, but, in my humble opinion, quite stupid. In today's market there are a LOT of agents who are not only limited in their experience, but limited in their knowledge. Many of these type of agents are being quickly flushed out of the system - or soon will be if they are, indeed, pulling shenanigans.
The bottom line seems to be that you now have an acceptable offer, subject to the cancelation of the prior offer, so you seem to be in a good position to secure the property.
One final word on the subject, just because the listing agent has apparently re-opened the property to you, if the original buyer satisfies any reason the seller sought to cancel, they could STILL be, and remain, in first position, so I wouldn't count your chickens until that cancelation has been completed. Good luck with your purchase.