Thank you all for all your valuable inputs. Even I have been looking for some information regarding this topics. Please let me share some with you all :)
The problem concerning here is what case of pronoun - nominative or accusative - will be used when the main clause need a accusative form but the dependent clause need a nominative form. Let's consider the following sentence -
It was written by him/he who was once in my class.
Of course this sentence can be re-written in such a way so as to avoid this confusing problem. But as we are addressing this confusing issue, let's not change it please. Let it be the way it is quoted.
The main clause need an accusative form - him (It was written by him not It was written by he) but the dependent clause need a nominative form - he.
After searching a lot, I came to know choosing one over the other is not a matter of correctness as both are correct, rather a matter of style. We can use him (accusative) in informal context, while we have to use he (nominative) in formal context.
Obviously if my sentence was the following, we didn't need to think of all these -
It was written by her whom I married 2 years ago.
The reason why we don't need to think of all these while choosing the case of the pronoun is here only her is possible. The main clause need us to use her (It was written by her), while the dependent clause also need us to use her.
I found this following usage note. I know this is not exactly applicable here, but we can take some info from that note. And my answer - whatever I wrote above - is based on that. Please let me know if my understanding is wrong.
Usage Note from The Cambridge Grammar of the English Language - (Page no. 507)
i. It is I [who am at fault].
ii. It is me [who is at fault].
Example [i] follows the general rules for relative clauses, with the
relative pronoun who being construed as first person singular by
virtue of its anaphoric relation to I. In the less formal [ii],
however, the antecedent is in accusative case, and here the first
person property is not carried over to who; the latter therefore
takes on the default 3rd person feature.