Preheat oven to 200C. Line a 23cm fluted tart tin, with removable base, with pastry of choice. Use a sharp knife to trim excess.
Melt butter in a medium frying pan over low heat. Cook onion, stirring, for 8-10 mins or until onion is very soft and translucent. Add bacon and cook, stirring, for 5 mins or until lightly golden. Set aside to cool slightly.
Whisk the egg, cream and milk in a jug. Season. Arrange the onion mixture and gruyère over the pastry case. Pour over the egg mixture. Bake for 25-30 mins or until just set.