Ferreyros was a friend and comrade-in-arms of Miguel Grau, Aurelio García and Lizardo Montero, who were known as the "Four Aces of the Peruvian Navy".
Upon his return to Peru in 1854, he took part in the capture of Arica and then went on to serve aboard the brig Almirante Guise, rising to alférez de fragata.
After the battle of La Palma on January 5, 1855, which put an end to both the war and Echenique's government, he was discharged from the navy, although shortly after he was readmitted, and re-embarked in the Amazonas.
The rebellious sailors, including Miguel Grau and Lizardo Montero, joined Manuel Ignacio de Vivanco's revolution against the government of Ramón Castilla, the same one that led to a new civil war in 1856.
Ferreyros, who did not want to join the revolution, returned to Callao, being assigned to the steamship Ucayali, later passing to the subtle forces that defended the port under the command of Guillermo Jones.
In September 1857 he was sent in commission to Panama and later to Rio de Janeiro, accompanying Rear Admiral Ignacio Mariátegui y Tellería [es], to meet the frigate Amazonas, which was returning from its trip around the world.
He stood out in the Battle of Abtao, where the allied Peruvian-Chilean fleet faced the Spanish screw frigates Villa de Madrid and Reina Blanca on February 7, 1866.
His ship made "the most accurate shots, with the longest range and most effect," as the head of the Spanish squadron himself pointed out in the respective part.
The government considered this attitude as insubordination and imprisoned the rebel sailors on the island of San Lorenzo, putting them on trial.
In July 1869 he left Callao aboard the corvette Union, bound for Rio de Janeiro, to take charge of the naval division that brought the monitors Manco Cápac and Atahualpa from the United States in tow.