Oh, yes. It happened at least once per kid at my house. At one point or another, the child ended up with somebody else's toy. There were explanations of anything from "Oh, he gave it to me, I think," to "I have *no* idea how it got in my pocket."
Always, it came out that the taking was a toddler-like impulse thing - "I liked it, so I kept it."
Sigh. For all the teaching parents do, sometimes it's making the bad decision - on impulse - that teaches the best lessons.
You asked your son to be honest, and he was. That's good. Thank him for that; you want to encourage his being honest and up front about such things, because he'll make more mistakes as he grows up. He needs to know you're for him even when you're against his action.
Take him over to his friend's house today (call first to make sure they're home). Let him 'fess up, give the toy back, and ask forgiveness in person. He could ask his friend if there's anything else he can do for him.
After you're in the car again, ask your son if he thinks there should be any other consequence. It sounds as if he has a sensitive heart right now; he might come up with something you might agree with (be careful that he isn't too hard on himself out of drama - he doesn't need to give all his toys away or anything like that). Or you might decide that isn't necessary to do.
Then declare an end to this little adventure - it's over and it will not be rehashed.
Will it happen again? I don't know. But an experience like this can often be a better teacher than a hundred lectures from Mama.