Matching/finding mathematical plot images
A natural approach is to first scrape the data from each plot; then come up with a distance measure to compare the similarity of the data from two plots; then given a template plot, loop over all plots in the database, compute the distance, and find the most similar one.

There are many tools for scraping plots (i.e., given an image that contains a plot, extract the underlying data).  See, e.g., https://academia.stackexchange.com/q/7671/705, https://stats.stackexchange.com/q/14437/2921, etc.

You'll have to choose the distance measure yourself.  You haven't answered questions about what notion of similarity you want to use, and we can't tell you what to use.  You could, for instance, rescale the data so that the x-axis and y-axis both vary across the range [0,1] (so all plots share the same scale), then use the $L_2$ distance (Euclidean norm) between the two time series represented on the plots.  That might or might not suit your needs.

I don't expect deep learning to be particularly useful here.  I would try more direct methods first.