Heat oil in a 12-inch heavy skillet over moderately high heat until hot but not smoking, then saute onion and shallots, stirring, until lightly browned, about 2 minutes. Reduce heat to moderate and continue to cook, stirring occasionally, until softened, about 8 minutes more. Add spinach and cook, stirring, just until wilted, about 2 minutes. Remove from heat and cool slightly. Transfer spinach mixture to a bowl, then stir in cream cheese, sour cream, salt, and pepper until combined well. Chill, covered, at least 1 hour.