Here is what the official NYC government website has to say:
Work you can do without a permit, Licensed Master Electrician or Registered Design Professional
No installation and modification to any electrical systems can be performed without a permit and a Licensed Master Electrician.
Work you can do without a permit
No installation and modification to any electrical systems can be performed without a permit.
That same page defines "Electrical Systems work" as:
Electrical Systems work is the new design and installation, alteration, or repair of any electric wires, wiring apparatus and other appliances used or to be used for the transmission of electricity for electric light, heat, power, signaling, communication, alarm and data transmission.
Installation and modification work may also include the necessary equipment, usually consisting of a circuit breaker(s), switch(es), fuse(s) and their accessories, connected to the load end of service conductors to a building or other structure, or an otherwise designated area, and intended to constitute the main control and cutoff of the supply.
It is pretty clear that this includes light switches and fixtures (see below).
There are many thousands of people who are doing the same thing you have done, and in most cases nobody from the government knows or cares.
However, if you would have an electrical fire as a result of your work, it is extremely likely that your insurance company would try to get out of paying, and you might face legal penalties.
Your thermostat is probably not included in the above requirements because it is low voltage, not full line voltage. There may be separate requirements for modifications to HVAC systems, but I am not aware of them.
UPDATE: There was some discussion in the comments about whether your case is included in the definition of "Electrical Systems work" or not, so here is another quote from the page:
Minor Electrical Work. Replacement and repairs, listed below, requires a NYC Licensed Master Electrician and an electrical permit, but does not require a DOB Inspection, for this type of work.
...
D. Replacement of defective controls (30 amps and under);
...
F. Replacement of fixtures in existing outlets (no more that 5 fixtures; no increase in wattage;
I could not find an official code definition of "Controls" used in part D, but a dictionary definition would definitely include light switches.
"Outlets" mentioned in part F means any place in the wiring system that is meant to connect something. This includes any wall or ceiling junction box intended to connect a light fixture (what code calls a "luminaire"), and it therefore prohibits you from replacing light fixtures by yourself.
A comparison between the city code for plumbing vs. electrical is also informative.
Section 28-105.4.2 of the NYC Construction code defines "Ordinary repairs" to include:
... the repair or replacement of any plumbing fixture, piping or faucets from any exposed stop valve to the inlet side of a trap.
Such "ordinary repairs" for plumbing do not require a permit.
I have not found any similar exception for electrical fixtures.