using http://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing as a reference.
"When a label is declared within a float environment, the \ref{...} will return the respective fig/table number, but it must occur after the caption. When declared outside, it will give the section number. To be completely safe, the label for any picture or table can go within the \caption{} " What you are getting for your float is the section number and similarly for your figure because it is not after the caption. -- Stephen