Under Virginia law, it doesn't matter if you were drunk or under the influence of a narcotic drug...you can still be charged with a DUI. Even if the narcotic drug in question is a legally prescribed drug, if it is impairing your ability to drive, then you are not allowed to be driving. One of the warnings/side effects of Ambien is that you are told not to drive a vehicle because as much as a day after you can be impaired by it. So if your blood test indicates that the Ambien was in your system then you may have an issue with that, regardless of whether you were drinking.
A third DUI is quite serious. If the other DUIs were within 5 years of this one, then you have to serve a mandatory six months in jail. If they were within the last 10 years, then the jail time is reduced to 90 days, but is still mandatory. There is a minimum fine of $1000 and your license will be suspended indefinitely (you can petition to have it returned after 5 years, but you will have to have an ignition interlock installed to get it back). The fact that you were also driving with no license will not go over terribly well with the judge. Consequently, it would be a good idea to get an attorney as soon as possible, either by hiring one or applying for the public defender.
Essentially, to rebut the evidence against you, you will have to try to show that your driving was not actually impaired by the Ambien. The problem is, because you not only failed the standard field sobriety tests but you were also in an accident, it strongly suggests that your driving was impaired. If the concentration of the Ambien in your system is low, however, then an attorney can try to argue that the driving issues and the test failure were not indicative of drug intoxication
but were just bad luck or bad driving.
I'm sorry I can't give you better news. I know it is not what you want to hear. But I just want you to be prepared to best fight this, and that would probably be with a lawyer to help you.