One day ahead, rinse the salt cod well, and then soak it in a large bowl of cold water in the refrigerator for 24 hours, making sure cod is completely submerged and changing the water several times. (See introduction to recipe above.)
Cut the potatoes into about 8-10 equal-sized pieces and place them in a small casserole. Cover the potatoes with cold water and bring them to a boil. Lower the heat and simmer until cooked, about 15-20 minutes. Drain and mash the potatoes using a hand masher, food mill, or potato ricer. (I like to mash them by hand directly in the casserole so that the purée dries out a little from the residual heat.) Reserve the purée.
While the potatoes are cooking, drain the soaked cod and cut it into 15-20 smaller pieces. Place them in a medium saucepan and fill with cold water, covering the cod pieces by about 1 inch (2.5 cm). Add the garlic and bring to the boil over high heat, then add the thyme and bay leaf. You’ll need to skim a lot of foam off at this point. Lower the heat and simmer for 15 minutes, continuing to skim. Drain, saving the garlic but tossing the thyme and bay leaf. As soon as you can handle the cod pieces, break them apart, tossing any bones as you go.
Place the cod flakes and garlic cloves into the bowl of your stand mixer. Begin mixing at low speed, and gradually increasing the speed, drizzle the olive oil over the cod until it is fully incorporated. Then slowly add in the cream (or half-and-half). Keep the mixer turning until you have a smooth mixture.
Preheat oven to 350° F (180° C). Add the potato purée and pepper to the stand mixer and keep processing until they’re fully incorporated.
Butter a medium-sized oven-proof gratin or other baking dish generously, and cut the rest of the butter into small cubes the size of a half-teaspoon. Turn the cod-potato purée into the gratin dish and distribute the butter cubes evenly over the top. Bake in the middle of the oven for 45 minutes to 1 hour, or until the top of the gratin becomes crispy and golden-brown.
Remove from oven and serve immediately with a gorgeous green salad. (We usually make our vinaigrette for the salad with plenty of lemon juice.) Serve lemon wedges on the table to pass around or place them directly on the plates. Bon app’!