I hate to sound trite, but intelligence (for which IQ is a proxy) is not only factor for success. Social skills will always be required - it seems like your two examples lacked these.
This is kind of the opposite of students that are underperforming that don't get the attention to help them keep up. Instead these are students that can overperform, but don't get the challenges, validation, and motivation - the general positive feedback - that will help them grow and succeed. Instead they are meet with disapproval and neglect since teachers both dislike them asking hard questions (thus challenging their authority among already hard to control kids) and don't have time to give them the attention they need (since they are most focused on the largest median group).