The modern expression “a fly in the ointment” suggests that something unpleasant may come or has come to light in a proposition or condition that is almost too pleasing; that there is something wrong somewhere.
The older version was “a fly in the amber,” meaning merely that something is as unexpectedly out of place as the fly that one occasionally finds embedded in fossilized amber.
Possibly the substitution of “ointment” for “amber” may have been through association of ideas, for “amber” was originally used in the sense of “ambergris,” and ambergris is used in some perfumed ointments.