BOSTON — When Marty Walsh won the Boston mayor’s race, Vice President Joe Biden was quick to pick up the phone to congratulate him.

But the Marty Walsh who Biden had on the other end of the phone wasn’t the Marty Walsh who was elected to succeed Mayor Thomas Menino.

The Marty Walsh who Biden had connected with was actually a former aide to the late U.S. Sen. Edward Kennedy.

That Marty Walsh said that before he could explain the mix-up, Biden launched into his congratulations, saying “Marty, you did it, you son of gun.”

Walsh, who said he has received misplaced calls for the other Marty Walsh in the past, said he quickly set Biden straight and passed along the cellphone number for the mayor-elect.

Walsh said Biden then jokingly congratulated him for not being mayor. Biden’s office did not immediately return a call for comment Wednesday.