Preheat your oven to 400°F (200°C) and set aside a baking dish large enough to hold the salmon and sweet potato mash.
Peel and chop the sweet potatoes into even chunks. Place in a pot with cold water, bring to a boil, and simmer until very tender, about 12-15 minutes. Drain well and mash with half of the butter and the milk or cream. Season with a pinch of salt and a touch of pepper.
Meanwhile, heat olive oil in a skillet over medium heat. Add the chopped onion and a pinch of salt; cook until translucent and lightly caramelized, about 5-7 minutes. Add the minced garlic and cook for another 30 seconds until fragrant.
Stir in the flour to make a light roux, cooking for 1 minute to remove the raw flour taste. Add the lemon zest, thyme, dill, and a splash of lemon juice. If the mixture seems dry, splash in a little water or broth.
Fold in the spinach and peas. Cook just until the greens wilt and the peas are heated through. Remove from heat.
Season the salmon pieces with salt and pepper, then add them to the skillet with gentle folds to coat them in the warm sauce without breaking them apart.
If you’re using sour cream, fold it into the creamy base now for extra richness. Taste and adjust salt, pepper, and lemon juice as needed.
Transfer the salmon and veggie mixture to the baking dish. Spoon or pipe the sweet potato mash on top, spreading evenly to create a smooth layer; dot with the remaining butter for a golden finish.
Bake in the preheated oven for 18-22 minutes, or until the top is slightly golden and the filling is bubbling gently around the edges.
If you’d like a crisper topping, switch to broil for the last 2-3 minutes, watching carefully to prevent burning.
Let the pie rest for about 5 minutes before serving to allow the layers to set and flavors to meld.