1. Heat oven to 375 degrees F. Fit piecrust into 9-inch tart pan. Trim excess crust from top edge of tart pan; refrigerate while preparing filling.
2. Heat a large nonstick skillet over medium heat. Add bacon to skillet and cook, stirring often, for 8 minutes. Add spinach to skillet and cook 1 minute, stirring until wilted. Using a slotted spoon, remove bacon mixture to a paper-towel-lined plate.
3. Return skillet to medium heat and add onions, 1/4 teaspoon salt and the thyme. Cover and cook 25 minutes over medium heat, stirring occasionally, or until browned. Remove from heat and allow to cool, uncovered, 5 minutes.
4. Whisk together eggs, half-and-half, pepper and the remaining 1/2 teaspoon salt. Stir bacon mixture and onions into eggs; stir to combine. Pour egg mixture into crust. Bake at 375 degrees F for 15 minutes. Reduce heat to 325 degrees F and continue to bake 20 minutes.
5. Heat broiler. Sprinkle tart with Gruyere and broil for 1 to 2 minutes. Let stand 5 minutes before slicing and serving.