The common quote goes as follows:
Imitation is the sincerest form of flattery.
This is actually a portion of a longer quote that is attributed to Oscar Wilde:
Imitation is the sincerest form of flattery that mediocrity can pay to greatness.
Another online source, Book Browse, points us to Charles Caleb Colton as the original (or at least earlier) author of the shorter version. Indeed, it is the title of number CCXVII (217, to save you the trouble) of his work Lacon: or Many Things in Few Words; Addressed to Those Who Think, published by Longman, Hurst, Rees, Orme, and Brown in 1820 (this publication is available at Google Books, by the way). The publication of this work predates Oscar Fingal O’Flahertie Wills Wilde’s birth by 34 years, so it confirms that Wilde didn’t write that portion.
However, Wilde did appear to extend the quote with the additional language about mediocrity. So far, I haven’t been able to unearth a citeable source from Wilde’s works. If you can point me in the right direction, I’d love to hear from you. At this point, this is another oft-quoted passage that does not have a clear initial use by the commonly-attributed author.