Preparing the codfish: First, de-salt the cod by soaking in plain water (enough to cover) for at least 24 hours in the fridge. Change the water 4 or more times.
If using salted, dry-weight codfish, bring it to a quick boil in milk (enough to cover the fish). Drain well and pat dry the codfish just before you are about to sauté it in the skillet. Using 2 forks, flake or shred the fish.
Codfish preserved in salt tastes much better than fresh cod, which is rather bland.
Cook the onion: In a large, non-stick skillet, heat 2 tablespoons of olive oil over medium heat, then add the onion. Cook onion until translucent, about 3 to 4 minutes (the goal here is to cook the onions without browning). Add the garlic and let cook for about 1 minute, stirring often. Transfer cooked onion and garlic to a small bowl, and reserve.
Using the same skillet where the onions and garlic were cooked, heat the remaining 3 tablespoons of olive oil and sauté the cod pieces over medium heat until soft, about 2-3 minutes (if using dry-weight cod) or cook fresh cod for 7 to 8 minutes, turning the fillets at least once. Remove from heat and flake the fillets with tongs or 2 forks while they are still hot. Season with salt, pepper, and the bouillon; stir. Add the lime juice and the chopped chives, and stir again. Reserve.
At this point, you can either combine the cooked flaked cod with the cooked onion-garlic mixture or reserve each separately for assembly according to the instructions below. Since this recipe does not call for sliced onions, when I prepare the dish I prefer to combine the cod and the onion-garlic mixture right away.
Making the mashed potatoes: In a large pot, cover potatoes with salted cold water and bring to a boil over medium-high heat; then, reduce heat to medium and let simmer until fork tender (about 15 minutes).
Drain the cooked potatoes and mash them well. Heat the heavy cream and milk together over medium heat until simmering. Add to the mashed potatoes and stir until combined. Stir in the salt, pepper, nutmeg, and melted butter. Let mixture cool and mix in the yolk. Reserve.
Assembling the fish pie: Preheat the oven to 375 degrees F (190 degrees C).
In a medium rectangular glass baking dish or oven-resistant ceramic baking pan, pile prepared flaked codfish in the center and fill the edges around the codfish with mashed potatoes, reserving about ⅓ of the mashed potatoes to pipe with.
Make sure the mashed potatoes should be slightly higher than the codfish pile.
Distribute the reserved cooked onions on top of the codfish pile (if not already mixed with the flaked cod), and then spread mayonnaise over the onions or flaked cod-onion mixture.
Pipe the remaining ⅓ of the mashed potatoes over the leveled mashed potatoes and around the edges of the baking dish using a medium star tip (you can make whatever design that you wish. I like to pipe waves all around my dish).
Bake uncovered for about 20 to 30 minutes or until mashed potatoes and mayonnaise are lightly browned.
Garnish the top with the olives and serve. Bacalhau a Zé do Pipo is best served with Portuguese full-bodied white wines, or light-to-medium, not too fruity, reds.