It's a special form of "to be" used in counterfactual clauses. That is when what you are saying isn't true: my heart is not a ball.   
Here is a reference to that use:  
[Wikipedia "use of the past subjunctive"][1]  
"The main use of the past subjunctive form, ***were***, which is also known as the *irrealis* is in counterfactual *if* clauses."  

Another reference discusses the form extensively:  
[Thoughtco "past subjunctive"][2]  

In ordinary speech, in your example sentence, some people will use the form "was".


  [1]: https://en.wikipedia.org/wiki/English_subjunctive#Use_of_the_past_subjunctive
  [2]: https://www.thoughtco.com/past-subjunctive-1691490