Q:

How was Law's fever cured by eating Ope Ope fruit?

I saw the episode in which Law had a fever and was about to die. 
Just by eating the Ope Ope fruit his fever was cured. 
As I understood, it makes you a genius doctor, but how was he cured instantly?

A:

Eating Ope Ope no Mi does not guarantee a cure per se. Remember the scene when Law tried to heal Rosinante? Rosinante laughed at him and said it doesn't work that way. Ope Ope no Mi is simply a tool/means to heal someone.
Law had to study being a doctor and medicine to cure himself with said knowledge. 
As the wiki has said,

The Ope Ope no Mi is a Paramecia-type Devil Fruit that allows its user to create a spherical space or "room", in which the user has complete control over the placement and orientation of the objects inside, making the user a Free Modification Human (改造自在人間 Kaizō Jizai Ningen?).

Like the description has said, the Ope Ope no Mi is indeed a powerful devil fruit but more powerful if the user has medical knowledge.

The Ope Ope no Mi has been described as having "miraculous" properties, having the ability to cure any kind of illness, but at the same time still requires some extent of medical knowledge in order to be utilized effectively as the fruit's influence only bends but not fully defy biological aspects of those recipient to its life-saving applications and its miraculous healing is actually focused on spatially extracting disease-causing impurities such as bacteria and viruses directly out of the patients' bodies. As such, if a doctor of prodigious medical expertise were to obtain this fruit's power, their medical abilities would be second to none.

