In a large pot of boiling salted water, cook pasta, stirring occasionally, until al dente according to package directions. Reserve 1 cup pasta water, then drain.
In same pot over medium heat, heat oil. Add shallot and corn and cook, stirring occasionally, until corn starts to gain color, about 8 minutes. Add garlic and cook, stirring, until fragrant, about 1 minute more.
Add ricotta, Parmesan, lemon juice, thyme, and red pepper. Add ½ cup reserved pasta water; season with salt and black pepper. Add pasta and toss, adding more pasta water if needed, until a glossy sauce forms.
Dollop with more ricotta. Top with basil.
