These devils are the source of many a leak. Chimneys contain 4 different types of flashing. All must be right or you will have a leak. Plus, the counterflashing that goes into the brick mortar joint must be right. A hairline crack above the flashing can allow vast amounts of water to run behind the flashings. Look for soldered corners of flashing that might have broken or have holes. Do not use caulk to repair these flashings!
from this site: http://www.stonewayroofing.com/story/default.view?rowID=58
here is a site that shows a pictorial of the siding installed...:
AS I suspected,,,the right way for the flashing to be installed on a brick chimney is to tuck the top edges of counter flashing into a horizontal mortar joint. counterflashing I suspect is a piece of flashing that overlaps the top edge of the normal flashing sorrounding the roof to chimney joint. search the web via google.com to look for other advisory sites on proper flashing installation on a chimney.
Hope this helps. in direct answer to your question ....My guess is you can try and use the existing flashing if all is is good shape other than it just separated. see if you can tell if it had some mechanical attaching devices like screws or nails that came loose. try replacing them and then to keep the flashing up against the chimney. if it were me then I would caulk this joint very well with a butyl rubber caulk..to seal it well. good luck. if selling I might hire this out ..to avoid problems with the sell. .LJ