$X\!\supseteq\!K\!\simeq\!0\Rightarrow X\!\simeq\!X/K$ ($\pi_1$ of a connected graph is free) How can I prove the following:
If $X\supseteq K$ is contractible, then the quotient $X/K$ is homotopy equivalent to $X$?
Since $K$ is contractible, we have a homotopy $H:id_K\!\simeq\!c_{k_0}$ between the identity and the constant map $K\rightarrow\{k_0\}\!\subseteq\!K$. We are trying to find $f:X\rightarrow X/K$ and $g:X/K\rightarrow X$, such that $f\circ g\simeq id_{X/K}$ and $g\circ f\simeq id_X$.
Most probably, $f$ must be the quotient projection, but what about $g$? I thought about defining $g$ as $x\!\in\!X\setminus K\mapsto x$ and $k\!\in\!K\mapsto k_0$, but is this continuous? Probably not. What else then?
Theorem: The fundamental group of a finite graph $X$ is free.
Proof: if $T$ is the maximal (spanning) tree of $X$, and $E$ the set of edges ($1$-cells) not in $T$, then $T$ is contractible and $X$ is homotopy equivalent to $X/T$, which is (homeomorphic to) a bouquet of circles $\bigvee_{i=1}^{|E|}\mathbb{S}^1$. Therefore $\pi_1(X)\cong F_E$, the free group on the set $E$. $\blacksquare$

Are infinite trees also contractible?
 A: You can also generalise the result on graphs to say that the fundamental groupoid of a graph on the set of vertices is a free groupoid; the notion of groupoid is quite natural in $1$-dimensional homotopy theory, and is also a natural extension of group theory. Their use often avoids the use of choice of base point and of tree. 
For the notion of free groupoid, see Chapter 4 of the downloadable 
Higgins, P.J. Notes on categories and groupoids, Mathematical Studies, Volume 32. Van Nostrand Reinhold Co. London (1971); Reprints in Theory and Applications of
Categories, No. 7 (2005) pp 1--195. http://www.tac.mta.ca/tac/reprints/articles/7/tr7abs.html
See also Topology and Groupoids, Chapters 8, 9. 
These two books apply the fundamental  groupoid $\pi_1(X,C)$ on a set $C$ of base point, so happily handling the case of non connected spaces.
A: The statement "if $K \subset X$ and $K$ is contractible, then $X/K$ is homotopy equivalent to $X$" does not hold in general.  Specifically, you need to add the assumption that the pair $(X,K)$ has the homotopy extension property (see Hatcher's algebraic topology book, proposition 0.17).  In particular, it works if $X$ is a CW complex and $K$ is a subcomplex.  
For a simple counterexample, let $X$ be a circle, and let $K$ be the complement of a single point in $X$.  Then $K$ is contractible, and $X/K$ is a non-Hausdorff space that is not homotopy equivalent to a circle.
Your proof that the fundamental group of a finite graph is free is correct, assuming that the graph is connected.
It is also true that any infinite tree is contractible, for the same reason that a finite tree is contractible (you can contract to any point using geodesic paths in the tree).  Thus the fundamental group of an infinite graph is also free.
