Put the raisins in a bowl and pour in the sherry. Set aside to plump up. Season the flour with the salt and pepper and spread it out on a large, flat dish or soup plate. Heat 2 tablespoons of oil in a large frying pan. Dip each chicken thigh in turn in the seasoned flour, then fry in the hot oil until browned, turning occasionally. Drain on paper towels.
Heat the remaining vegetable oil in a large, deep frying pan. Add the onion slices and crushed garlic and cook for 2-3 minutes. Meanwhile, peel, core and dice the apples.
Add the diced apple to the onion mixture with the almonds. Cook stirring occasionally, for 3-4 minutes, then add the soaked raisins, with any remaining sherry. Add the chicken pieces to the pan.
Pour the stock and tequila over the chicken mixture. cover the pan with a lid and cook for 15 minutes, then take off the lid and cook for 10 more minutes or until the sauce has reduced by about half.
Check that the chicken thighs are cooked by lifting one out of the pan and piecing it in the thickest part with a sharp knife or skewer. Any juices that come out should be clear. If necessary, cook the chicken for a little longer before serving. sprinkled with chopped fresh herbs, if desired.