Your second sentence is confusing. It's not clear who you wanted to talk to (did you want to talk to him, or did you want to talk to the person he was talking to?).
June's answer is okay if your meaning was that you wanted to talk to the person "he" was talking to. (It's a comma splice, though, so it would be better to make it into two sentences, or else use a conjunction after the comma.)
If you meant that you wanted to talk to *him*, then you should say, "Who was he talking to when I met him? I wanted to talk to him too."