Will the heart keep beating if it's separated from the body?
Short version
The heart  has the ability to beat independently of the brain as long as it has oxygen. The heart will eventually stop beating as all bodily systems begin to stop working shortly after brain death. Remember the heart can beat, but your diaphragm and lungs wont. hence the cardiac muscles undergo asphyxiation and die off. However, immediately after death, there is enough oxygenated blood in the body to keep thing moving for a while

Long version
There is a simple explanation why.

As you know every muscle in the body has to receive stimuli from the neuromuscular junctions (and subsequently the nervous system) in order to contract. 

The heart is a bit different in that it is not regulated by the brain, but the regulatory mechanisms lie within the heart itself. The heart conductive system contains a special group of cells called the pace maker cells (SA node) that fire at regular intervals and cause the heart to beat.




  Each heart beat is triggered by an electrical pacemaker - a group of cells in the heart that have the ability to generate electrical activity. They cause electrical impulses to spread over the heart and make it contract.
  The largest natural pacemaker of the heart is called the sinoatrial or SA node and is found in the right atrium. From it, specialised groups of cells that carry the electrical charge lead off to the rest of the heart.


(Taken from here)

The brain regulates the rate of the heart beat sure, but it does not send the signals that cause the heart to beat in itself.

In short, even after disconnection, the SA node still sends the impulse down the AV node and purkinje fibres that spread out across the cardiac musculature and cause them to contract, causing the heart to beat. This will continue for a while till they run out of energy and stop.

You can read more about it here:Wiki