Ferreira, 66, stepped down late on Wednesday and almost instantly Panathinaikos confirmed on the club website that Argentine Rocha, 58, a former Greens players who also coached the club from 1994 to 1996, would take charge.
Panathinaikos, who have been Greece champions 20 times, have made a poor start to the season and are eighth after 10 matches, trailing arch-rival, league leaders and champions Olympiacos Pireaus by 15 points.
There are also bottom of their Europa League group which includes Lazio, Tottenham Hotspur and NK Maribor with just two points from their four matches.
Rocha spent nine years at the club as a player from 1980-89 and is remembered as one of the Greens' best players as well as the coach who took them to the semi-finals of the Champions League in 1996 when they lost to Ajax.
"Panathinaikos has entered into a critical period and we need everyone to be united from the administration, to the players and the fans, as well as generally anyone who can help," said Rocha.
Ferreira said, in parting: "Mistakes were made, also on my part, but the possibilities for improvements were limited."
He added: "I had to deal with enemies in the press who decided to magnify the complaints of fans making my task even more difficult, and this climate created by those people had a negative effect on the players.
"It got to the point where I felt that I was more of a problem for Panathinaikos and not the person to solve the problems, as I was last season, and for all of these reasons I decided to resign."