How apply $\mathbf{F} = m\mathbf{a}$ to a whole pulley system? When we are dealing with systems of bodies we apply $\mathbf{F}= m\mathbf{a}$ to the whole system.
How do I apply $\mathbf{F}= m\mathbf{a}$ to the whole system in the following example.? 
($m_1 \lt m_2$)

Also, why is the following application of $\mathbf{F}= m\mathbf{a}$ wrong?
For the whole system,
$$\mathbf {F = ma \downarrow }$$
$$\mathbf {m_1g + m_2g = m_2a -m_1a}$$
 A: The short answer:
Because the pulley exerts no force on the system, we can redraw it to understand it better:
 
Because the masses has the same acceleration, you can look at the system as a system of one mass of m1+m2, where the external forces are: m2g, m1g (T are internal forces). this forces try to increase  the acceleration  in different direction so they are opposite to each other. finally we get:
(m2 - m1)g = (m1 + m2)a

The long answer:
We can get the same answer by applying F=ma to each mass.
m1a = T - m1g
m2a = m2g - T

notice that I chose the acceleration as m2 going down, and m1 going up - as you did in your sketch. this is why m2a = m2g - T , and not m2a = T - m2g. (this led you to your wrong answer!)
We add both equations to get:
(m2-m1)g = (m1 + m2)a

A: The center of the pulley is fixed.  There is force on the pulley from its axle, which is supplied by the support.  You can write an equation saying the acceleration of the pulley is zero, and will find that the force upward from the support equals the force downward on the two masses due to gravity.  If the pulley were free you would be correct and the pulley would be accelerating downward.
