I would want an independent mechanic to check out either car before buyig, especially the one in an accident.
It seems like the price on the 06 should be lower considering. You get a few more horsepower (15 I think) and a metal ring around some of the interior knobs in the 07 - otherwise they are the same, not counting any difference in options.
If the 06 checks out OK, and they come down on the price, I'd lean that way, based on the info provided. Otherwise, I opt for the 07.
2011 528i Space Gray - Black - Light Wood Trim
2006 325xi |SG - Terra - Walnut | Steptronic | Premium Package - Nav | Zenon Adaptive Headlights | Blacklines; iPod Adapter