Preheat the oven to 350°F. Lightly grease a 9-inch tart pan with a removable bottom; set aside.
In a large bowl or food processor, add the flour, baking powder, and salt. Mix or pulse the dry ingredients until well combined.
Add the butter. If using a bowl, take a fork or your fingers and cut the butter into the flour mixture until it begins to crumble. If using a food processor, pulse for about 8 seconds, or until the pastry begins to crumble.
Add the sour cream. Stir and/or pulse until a dough forms. Cover the dough and refrigerate for 30 minutes. Meanwhile, make the filling.
Rinse the leeks very well. Trim the bottom of each leek, cutting off the root, then chop off the dark green leaves and discard. Dice the leeks into small pieces. Fill a small bowl with cool water and place the chopped leeks into the water. Allow the leeks to soak for 5 minutes, then strain in a colander under running cool water, removing any excess debris. Set aside.
Cut the strips of bacon into small pieces, then add to a large frying pan. Cook on medium-low heat for about 2 minutes, then add the leeks and oil to the pan. Cover with a lid for 5 minutes, stirring occasionally. Remove the lid and continue cooking for 5 minutes, or until the leeks have cooked down. Add the spinach and cook, stirring, until wilted. Add the thyme, garlic, salt, and pepper, then turn off the heat and set aside.
In a medium bowl, whisk together the eggs. Add the sour cream to the bowl and continue to whisk until well combined. Fold the cheese and bacon/leek mixture into the eggs.
Remove the dough from the fridge and roll out on a lightly floured surface to about ¼-inch thick. Place the dough on top of the tart pan, and gently push the crust into the sides and bottom of the pan. Trim the excess dough. Pierce the bottom of the pan with a fork several times, then add a layer of parchment paper, filling the middle with pie weights or dry beans.
Place the tart pan onto a baking sheet, then bake for 10 minutes. Carefully remove the parchment paper and pie weights from the center and return the tart back to the oven for another 10 minutes, or until lightly golden.
Remove the crust from the oven, then slowly pour the filling into the baked pastry. There may be a few tablespoons extra of the egg mixture; be careful not to overfill. Bake for 15-18 minutes or until the filling is set. The center should be slightly wobbly.
Remove from the oven and let cool for 10 minutes, then serve. Store leftovers in a tightly sealed container in the refrigerator for up to 4 days.