Peel and quarter sweet potatoes. Place in large pot, cover potatoes by 1"with salted, cold water and simmer until tender, about 20 minutes. Drain potatoes, transfer to medium bowl and while still warm, coarsely mash. Using electric mixer beat in butter, eggs, salt and pepper to taste until smooth.
In large skillet, heat oil over medium heat. Add leeks and cook, stirring often, until softened, about 10 minutes. Add mushrooms and garlic and cook, stirring often, until mushrooms release their liquid, allow to evaporate. Stir in thyme and season to taste with salt and ground pepper. Remove pan from heat and let cool.
In medium bowl, mix ricotta cheese, spinach, egg whites, dill, red pepper flakes and 1/2 tsp salt until blended.
Preheat oven to 375 °F (180 °C). Unfold one puff pastry sheet and place on lightly floured surface. Roll out to a 14" circle. Transfer circle to ungreased 8 1/2 or 9" spring form pan and press gently to fit into bottom and side (there will be some overhang for folding over top of pie).
Spoon sweet potato mixture into pastry and pat into even layer. Spoon mushroom mixture over potatoes and spread evenly. Top with spinach mixture (filling may come slightly over top of pan). Carefully fold pastry overhang on top of the filling. Brush edges with egg wash and seal.
Unfold second puff pastry sheet on lightly floured surface. Roll out slightly, then cut into an 8 1/2 to 9" circle. Place circle of dough over top and press edges into pan to seal. Brush top with egg wash and, using a small sharp knife or razor blade, slash top in a crosshatch pattern.
Bake 35 to 40 minutes. When well browned, loosely cover top with foil. Reduce heat to 350 °F (165 °C). Carefully remove side of pan and brush sides with egg wash. Bake until sides are golden, about 35 to 40 minutes. Remove from oven and let cool slightly before cutting into wedges and serving.