Basically, what you need to do is when a custom post is added/updated it needs to Geocode via Google the Lat and Long from the postcode/zip code etc and store these in separate fields.

Then you add a text input to search, the input for this is Geocoded via Google too to get the lat and long of the location, then parse this through a fairly simple SQL which calculates the distance between the the search lat and long and each of the rows lat and long, then only show ones which are within X miles.

Geocode like so:

$address = 'London, UK';
$lines = explode("
",file_get_contents('http://maps.google.com/maps/geo?q='.urlencode($address).'&output=csv&key='.$google_map_key));
list($x,$x,$lat,$long) = explode(',', $lines[0]);

SQL like so:

$miles = 5; // Show only results within 5 miles
mysql_query("SELECT *, truncate((degrees(acos( sin(radians(`lat`)) * sin( radians('".$lat."')) + cos(radians(`lat`)) * cos( radians('".$lat."')) * cos( radians(`long` - '".$long."') ) ) ) * 69.09),1) as distance FROM `postcodes` WHERE truncate((degrees(acos( sin(radians(`lat`)) * sin( radians('".$lat."')) + cos(radians(`lat`)) * cos( radians('".$lat."')) * cos( radians(`long` - '".$long."') ) ) ) * 69.09),1) <= ".$miles." ORDER BY `distance` ASC");

SQL is just off the top of my head, so hopefully it will work, if not it will point you in the right direction.