Hi Boboclan,
I was in a similar situation as you and just got my greencard a couple of weeks ago through DV2010.
I was in the US for almost 8 years on a J1/H1B and was out of status when I received my 1st NL in June. Besides my company immigration lawyer, I consulted 2 additional immigration lawyers to inform me on appropriate steps for my situation.
They told me there is a big difference between out of status and unlawful presence. If you overstayed your visa for less then 180 days, you are considered out of status. If you overstayed over 180 days you are considered unlawfully present.
Being out of status is usually not penalized depending on your case, but being unlawfully present is almost a guarantee for a 10 year ban and will prevent you any access to the US during that period and you will be disqualified for the DV lottery.
As various people said before, I would you suggest to leave the US and opt for consular processing. I can almost guarantee you that AOS will not be possible as you are currently
out of status and therefor your status cannot be adjusted.
I have left the US with 4.5 months of being out of status, filled out all paperwork truthfully and had no further questions regarding any of this during my interview and as I mentioned before, successfully obtained my green card.
In short:
don't worry too much as being out of status does not necessarily have to lead to ineligibility for the green card. Just make sure you don't overstay for more than 180 days and consult a good immigration lawyer if you feel it will help your case!
Most immigration lawyers do a free first consultation and here's also a link to a forum that is frequented by immigration lawyers who give free advise and who you can hire for further assistance:
http://www.avvo.com/legal-answers-search/immigration.html
good luck!