My dentist failed his part two boards twice he told me, I actually remember seeing him on campus when i was an undergrad and he went to dental school. His entire class graduated and he was flying from state to state (i dont know how it works really) and flying patients to do exams on them and so on to pass the exam. Long story short he finally passed and graduated back in Nov. 2002 when his class ofcourse graduated May 2002. He started out as an associate for a year. Now he owns his own practice and employees two dentists, and he is going to open his second office very soon. Financially he is doing better than those who got 4.0s and ranked top 10 in their class. He is just extremely business smart and works hard, LONG HOURS. But i guess his hard work paid off, he already paid off his practice loan and is making about 400K net for himself. Not bad for someone in the bottom 10 of his class and that couldnt barely passed his boards on his third try.
For residency, it could matter, ask the experts i guess. But if you have an upward trend in your grades and do very well on your boards you should be fine. If your grades still progress to be low and you are very stuck on specializing than practice for a few years, and try to do apply for a residency after a few years.
Good luck.