Place the shrimp shells in a saucepan, along with the thyme, bay leaves and peppercorns. Add 3 cups of water, bring to a boil, reduce the heat and simmer until reduced by a third, about 30 minutes. Strain the liquid (you should have about 1 cup) and discard the shells.
Heat the oil in a large skillet over moderate heat. Add the onion, scallions, salt and pepper and saute until soft, about 3 to 5 minutes. Add the garlic, tomatoes, aji and reserved shrimp stock and simmer until thickened, about 5 minutes. Stir in the coconut milk, shrimp, lime juice and peas, and cook until the shrimp are pink and just cooked, turning the shrimp once as they cook, about 3 minutes. Serve over white rice.