It's not likely relevant, really. Sometimes people are depressed after flu or ear infection and attribute it to that.
There's some sense in:
1. If you're stressed and/or avoiding sunlight, you're more likely to be depressed and fall ill.
2. You feel less pleasure while severely sick. Personally, I notice my affect when thinking about everything is dramatically different. I discount it for that reason.
3. Depression apparently involves some feedback loops that can make it a fairly stable equilibrium; so the shift in experience during the sickness might linger (perhaps the isolation and lack of sun while sick lingers).
I don't see any studies showing a strong link. To present my own anecdote, I had a dozen ear infections before my teens and have never experienced depression. This is a very small bit of evidence, though.