Although failing a preclinical course is a red flag, the good news is that you can overcome it and still get into a competitive residency. I've seen that happen many times over during the 15 plus years I've been advising students.
Operaman made some great points in his post about taking the time to understand what went wrong. That's really the key. It's too risky to assume you have all the answers to the problem. I've worked with a lot of students who've struggled in one or more preclinical courses. What I've learned is that students are not always the best judge of the factor or factors that led to the failure. And it's often more than one factor.
For an accurate diagnosis, I would recommend meeting with your school's academic advisor or staff member. Ideally, this should lead to an in-depth discussion, a diagnosis, and a targeted plan to prevent this from happening again.
Good luck, and know that it can be done,