Last time I went to Disneyland was the week after labor day 1999 (yeah, it's been a while) and I think that week is the best time to go. Sure, if you have kids they'll have to miss the first week of school, but it's worth it. It was very uncrowed when I went during that week and the lines are extremly short (90% of the estimated wait time was how long it takes to get from the entranceway to the actual loading area for the ride). Definitly, the best time to go is the week after labor day!
Last year July 4th fell on a Sunday and Monday was the "official day off". I went on Monday and the crowds were non-existant. I would say the best bet is Monday. A lot of kids will be going back to school the next day, the hours are a bit shorter.....all make for a line-free day.