Combine the oil, butter, garlic, thyme, celery, 1/2 the Spanish and 1/2 the brown onion in a large saucepan over a low heat. Cook slowly for about 45 minutes or until mixture caramelizes. Add remaining onion to pan and cook for a further 20 minutes. Stir in the stock and simmer gently for another 20 minutes. Stir in sherry and season with salt and pepper.