Add the flour, 1 teaspoon each of salt, black pepper, garlic powder, onion powder, and ¼ teaspoon of cayenne pepper in a gallon zip-top bag. Seal the bag and shake the ingredients up to combine them.
Rinse and pat chicken thighs dry with paper towels. Season both sides of the chicken with ½ teaspoon each of salt, black pepper, and garlic powder. Place the chicken thighs in the bag with the flour, seal the bag, and gently toss the bag around to coat the chicken in flour.
Preheat your oven to 350°F while you pan-fry the chicken.
Heat the olive oil in a medium cast-iron or oven-proof skillet over medium-high heat. Once the oil is hot but not smoking, carefully place the chicken thighs, skin side down, in the skillet.
Cook the chicken for 5-7 minutes or until a golden brown crust forms. Flip the chicken and cook for 3-5 minutes on the other side or until golden brown. Transfer the chicken to a plate while you make the gravy. Do not worry about fully cooking the chicken. It will continue to cook in the oven.
Melt the butter in the same skillet you cooked the chicken in. Add the onions and cook for 2-3 mins until they begin to soften. Add the garlic and cook for an additional minute or until fragrant. Add the flour and cook for 2-3 minutes to get rid of any raw flour taste. Constantly stir the flour with a wooden spoon so that it doesn't burn.
Add the stock to the skillet and cook the gravy for 3-5 minutes, or until thickened. The gravy should coat the back of a spoon. Season the gravy with salt and cracked black pepper to taste.
Place the chicken back into the skillet with the gravy. Spoon gravy and onions over the chicken and place the skillet in the preheated oven. Cook the chicken for 35-40 minutes or until very tender.
Allow the chicken to cool for about 10 minutes and serve over white rice if desired.