In a skillet over medium heat, melt the butter. Add the sliced onions and cook until they become soft and translucent, about 10 minutes.
Sprinkle the onions with salt and sugar, and continue cooking, stirring occasionally, until they are caramelized and golden brown, about 20-25 minutes.
Add the minced garlic to the skillet and cook for an additional 1-2 minutes, until fragrant.
Transfer the caramelized onions and garlic to the crock pot. Pour in the beef broth and white wine (if using), and add the thyme and black pepper.
Cover the crock pot and cook on low for 8 hours or on high for 4 hours until the flavors meld together.
About 30 minutes before serving, preheat your oven to 350°F (175°C). Place the slices of bread on a baking sheet and toast them in the oven until golden brown, about 10 minutes.
Once the soup is ready, ladle it into oven-safe bowls or crocks. Top each bowl with a slice of toasted bread and a generous amount of Gruyère cheese.
Place the bowls under the broiler for 2-3 minutes or until the cheese is melted and bubbly, watching closely to avoid burning.
Serve hot and enjoy your delicious Crock Pot French Onion Soup!