As with most Doctor who "running gags", this one works on a couple of different levels;
- The Doctor enjoys mocking Mickey. In Aliens of London he refers to him as Ricky and then parlays some witty banter to mock him further:
MICKEY: I bet you don't even remember my name.
DOCTOR: Ricky.
MICKEY: It's Mickey.
DOCTOR: No, it's Ricky.
MICKEY: I think I know my own name.
DOCTOR: You think you know your own name? How stupid are you?
And in Boom Town Rose even calls him on it. He's just doing it to amuse himself:
DOCTOR: Here comes trouble! How're you doing, Ricky boy?
MICKEY: It's Mickey!
ROSE: Don't listen to him, he's winding you up.
As to why the parallel Micky was called Ricky, there are a few options. Most obviously is that it was simple coincidence. Failing that, the Doctor may have sensed the fixed point created by Ricky Smith's death. We simply don't know.
Out-of-Universe, this is an obvious callback to a running joke from the First Doctor Who series with William Hartnell. He would regularly get the name of his companion (Ian Chesterton) wrong, calling him Chesterfield and Chatterton, etc which then allowed for small humourous exchanges with Ian and Barbara, for example:
DOCTOR: Oh? Well, I don't know that I was under any obligation to report my movements to you, Chesterfield.
BARBARA: Chesterton.
DOCTOR: Oh, Barbara's calling you.