I don't understand why the police would prosecute you for no insurance under these circumstances, unless they checked the car via the PNC and it was registered to you already, when you say you were test-driving it.
If what you say in your question really happened, you need your friend to appear in court as a witness, swear and oath and explain to the court what he did, and more importantly, for what reason he backdated the V5.
It is then up to the magistrates whether they believe you or whether they think your friend is using the 'backdated V5' excuse as an attempt to get you off a no insurance wrap.
Best of luck.