My first advice to you is that you cannot change the past and no amount of grieving over the past is going to fix the past. And no amount of worrying is going to change the future, rather studying on the left over courses will benefit you greatly.
That being said: what are your circumstances?
Do you have enough money to apply? If so, apply to grad school. Do you not have that much money and are in debt? Well then, consider working in your field perhaps and then applying to grad school later in life?
What is the point of a PhD? or any grad degree? Or undergraduate degree?
The point of education is to apply that knowledge to real life application, or further construction of knowledge or benefiting society etc. You can have a PhD and do nothing with it and not benefit yourself nor others, nor anything. You can benefit anyone with hard work regardless of PhD or undergraduate degree.
You cannot change the past, and you can change your future. You know your past, but you don't know your future and you know deep inside you are capable of acheiving well. If you work hard in the final courses, you will acheive good things and you will be content, because whatever hard work you put in, you will see benefit of it, even if you don't acheive post-doc, you will still get somewhere.