Preheat the oven to 375°F. Place the potatoes in a large pot of salted water and bring to a boil. Cook until the potatoes are fork-tender, about 15 minutes. Drain well, then return them to the pot. Add 2 tablespoons of butter and the milk, then mash until smooth. Season with salt and pepper and set aside.
Melt the remaining 2 tablespoons of butter in a medium skillet over medium heat. Add the onion and cook until softened, about 5 minutes. Stir in the flour and cook for 1 minute. Slowly whisk in the fish stock and continue stirring until the sauce thickens, about 3 minutes.
Add the cod pieces and frozen peas to the sauce. Cook gently for 3 to 4 minutes until the cod just begins to flake. Remove from heat, stir in the parsley, and season with salt and pepper.
Transfer the fish mixture to an 8-inch baking dish. Spread the mashed potatoes evenly over the top. Bake for 20 to 25 minutes until the potato topping is lightly golden.