Giving to the church or giving to the poor? Which does God prefer most, giving to the church or giving to the poor?
(From an Evangelical, Sola Fide perspective)

The question is based on a false dichotomy.  Neither is more pleasing to God.  

Both types of giving are a sign of obedience to God, and an act of love and mercy if our motive in doing either is pure.  If we are doing either simply to do so, or to "earn points" then neither is pleasing to God.  If we're trying to earn points with God, then it isn't an act of love or charity, but rather one of selfishness.

Of course, love is the greatest commandment. 


  Matthew 22:36-40 (KJV) 36 Master, which is the great commandment in the law?  37 Jesus said unto him, Thou shalt love the Lord thy God
  with all thy heart, and with all thy soul, and with all thy mind.  38
  This is the first and great commandment.  39 And the second is like
  unto it, Thou shalt love thy neighbour as thyself.  40 On these two
  commandments hang all the law and the prophets.


The verses supporting Sola Fide (Salvation by Faith Alone) are covered extensively elsewhere on the site, so I'm omitting them in the interest of brevity.  Suffice it to say that the doctrine teaches that our "good works" don't get us to heaven, and are not, in and of themselves, pleasing to God.  Isaiah 64:6 state that our righteousness is no more good than "filthy rags".

The giving a tithe or an offering can be compared the sacrifices brought to the Temple in Old Testament times.  


  Hosea 6:6 (KJV) For I desired mercy, and not sacrifice; and the knowledge of God more than burnt offerings.


In other words, it's the heart condition - the love that counts - what David calls the "Inner parts" in Psalm 51:6 (KJV)


  Behold, thou desirest truth in the inward parts: and in the hidden
  part thou shalt make me to know wisdom.


Giving offerings is also an act of mercy (depending on what the Church actually does with the money.)  In our Church, for example, there is a distinction between tithes and offerings.  


Tithes are the 10% of our income that we give to the Church, which is used to support the business of the Church - pay for the building, electricity, Hymnals, Bibles, and other mundane needs.  These allow the Church to do its business - training up Christians, teaching us the principles of God, teaching us to love our neighbors, and equipping us to witness to others and see them get saved.  The motivation for giving tithes should be two-fold.  One reason is simply because God demands it, and we obey.  The other is that we know that ultimately, the money all works directly or indirectly toward saving people from an eternity in Hell, and that's loving people.
Offerings are over and above tithes.  In our Church, they are all designated for different purposes: Supporting missionaries, helping those in need, etc.  The pure motivation for giving is to give to those who need it more than us, again, out of love and mercy.


Of course, not everyone gives for the same reasons.


There are, of course, those that think they can buy their way into heaven.  
There are those that give large sums of money to "look good"  ("Oh, look at me, I'm a righteous person because I give so much money."  Jesus rebuked this in His teachings, by the way.) 


There are those that give to the poor for similar purposes.  I don't believe that God honors this either.  What is pleasing to God is...


love
mercy
obedience
humility


and a whole host of other qualities that have to do with the condition of our hearts, and not our external actions.  Where people get confused is that if we do have those traits, we will naturally give because we love, have mercy, are humble, etc.  Those are the "fruits" that grow out of the seed of our love.