Dear miracle114,
As salaam alaikum,
In the main, I find the understanding you seem to have extracted from the verses to be correct in my humble opinion. From my perspective, I think it is clear from those verses that the Qur'an encourages a particular approach criteria to 'injustice' or 'evil' imparted on an individual. From 42:40, three points are noteworthy:
(1). With all other conditions constant, revenge is something that is allowed in the case of an action acted against one
(2). It is more preferable and a times beneficial, in fact even rewardable with God if a better approach is resorted to. This would entail forgiving/ pardoning or even a reconciliation, if not any better approach - consequently averting the 'evil/ bad' by otherwise 'good.'
(3). What is not expected of an individual during such an action acted upon them is 'injustice.' This can for instance be enacted when one retaliates against those who are not the actual perpetrators of the mistreatment against them.
To emphasize on the above, verse 42:41 underscores point (1) while 42:42 supports the idea in (3). Further, verse 42:43 ratifies point (2) above while an earlier verse 42:39 relates back to point (1).
From a wider overarching Qur’anic theme, the Qur'an recommends such an approach underpinned by the criteria above especially in emphasis to point (2) where possible and warranted. See verse 41:34 as quoted below.
“And not equal are the good deed and the bad. Repel by that which is better; and thereupon the one whom between you and him is enmity [will become] as though he was a devoted friend.” (Qur’an, Fussilat 41:34)
To resonate this even further, the Qur’an relates to a consistent series of instructions that focus on the said approach. The following are some of the verses to the effect:
“And those who are patient, seeking the countenance of their Lord, and establish prayer and spend from what We have provided for them secretly and publicly and prevent evil with good - those will have the good consequence of [this] home” (Qur’an, Ar-Ra’d 13:22)
“Repel evil by what is better. We are aware of what they describe.” (Qur’an, Al-Mu’minun 23:96)
As in 13:22, and relating to what is referred to in 42:40 (fa ajruhuu 'ala llahi), verse 28:54 attests to a double reward to those who avert an 'evil' with a 'good' gesture.
“Those will be given their reward twice for what they patiently endured and [because] they avert evil through good, and from what We have provided them they spend.” (Qur’an, Al-Qasas 28:54)
Hopefully that helps in some way God willing.
Regards,
Athman.