I have no specific information about your ancestor, Margaret, but it would appear that my g-g-grandfather may have been your man's commanding officer.
I have transcribed Major Samuel H. Wilds' military service record at http://www.webmousepublications.com/itow/military/mil-shw.html and you are free to use any information of value to your search.
Ellen