Preheat the oven to 350 degrees F. Grease a 2-quart baking dish and set aside.
In a large saucepan, melt the butter over medium-high heat. Add the onions and poblano peppers and cook, stirring, for 2 minutes. Add the garlic and cook, stirring, for 30 seconds. Add the corn, thyme, 3/4 teaspoon of the salt, and the cayenne, and cook, stirring, until just tender and starting to turn golden, 4 minutes. Add the flour and cook, stirring, for 2 minutes. Remove from the heat and let cool slightly.
Put half of the corn mixture in a food processor with a little of the custard and blend until smooth.
In a large bowl, whisk the eggs, cream, sugar, thyme, remaining 3/4 teaspoon salt, and black pepper until frothy. Add the pureed corn and whole corn mixtures and the cheese, crumbled bacon, and green onions and whisk to combine. Pour into the prepared dish and bake until set and a knife inserted into the center comes out clean, 50 minutes to 1 hour.
Remove from the oven and let rest for 10 minutes before serving.
Yield: 8 servings