Just one bad grade in an advanced level course is not going to ruin your chances at an Ivy League. However, consistently underperforming in advanced classes in your area-of-interest classes will penalize you in the applications process.